+ All Categories
Home > Documents > C Journal Prints | Shree Ram College Bhandup

C Journal Prints | Shree Ram College Bhandup

Date post: 05-Jul-2018
Category:
Upload: unknown
View: 220 times
Download: 0 times
Share this document with a friend

of 45

Transcript
  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    1/45

    PROGRAMMING WITH C

    INDEX

    SR NO. CONTENT SIGNATURE

    1(A). Write a program or matri!

    m"#tip#i$atio%.

    1(&). Write a program to pri%t '

    1

    1 1

    1 1

    1 * 1

    1(C). Write a program o m"#tip#i$atio%

    ta+#e i% gi,e% ra%ge.

    (A). Write a program to -ip#a/ irt 0%Prime %"m+er i% gi,e% 2i+o%a$$i

    erie.

    . Write a program to $a#$"#ate a "i%g

    "%$tio%.

    *(A). Ui%g Re$"rio% $a#$"#ate a$toria#.

    *(&). Ui%g Re$"rio% ge%erate 2i+o%a$$ierie.

    3. Write a program to $reate tr"$t"re

    $ri$4et 5 -e$#are a% arra/ o tr"$t"re

    5 -ip#a/ i%ormatio%.

    6. Write a program to $o%$ate%ate

    t"-e%t irt %ame7 mi--#e %ame7#at

    %ame i% o%e arra/ 0t"-e%t.

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    2/45

    8(A). Write a program to i%- a "+tri%g i%

    a gi,e% tri%g.

    8(&). Write a program to $o%,ert tri%g i%to

    %"m+er.

    9. Write a program to :ap t:o

    %"m+er +/ "i%g poi%ter.

    ;. Write a program to ort e#eme%t o

    arra/ 5 i%- ma##et %"m+er i% arra/

    "i%g poi%ter.

    1

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    3/45

    Practical 1-A:

    Source Code:

    #include

    #include

    #include

    void main()

    {

    int a[10[10!b[10[10!c[10[10!i!"!!m!n!$!%&

    clrscr()&

    $rint'(n*nter the ro+s and colums o' the 1st matri,:)&

    scan'(d d!m!n)&

    $rint'(n*nter the ro+s and colums o' the /ndmatri,:)&

    scan'(d d!$!%)&

    $rint'(n*nter the element o' the 1st matri,:n)&

    'or(i0&i

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    4/45

    'or(i0&i

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    5/45

    {

    c[i["c[i["a[i[8b[["&

    2

    2

    2

    $rint'(3he $roduct o' the / matri, is:nn)&

    'or(i0&i

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    6/45

    Output:

    Practical 1-9:

    Source Code:

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    7/45

    #include

    #include

    void main()

    {

    clrscr()&

    int i!"!!m&

    'or(i1&i

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    8/45

    Practical 1-;:

    Source Code:

    #include

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    9/45

    #include

    void main()

    {

    int i!"!ro+s!cols&

    clrscr()&

    $rint'(*nter no. o' ro+s:)&

    scan'(d!ro+s)&

    $rint'(*nter no. o' cols:)&

    scan'(d!cols)&

    $rint'(n8883he multi$lication888)&

    $rint'(n)&

    'or(i1&i

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    10/45

    Practical /:

    Source Code:

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    11/45

    #include

    #include

    void main()

    {

    int a0!b1!c0!i!n!count0&

    clrscr()&

    $rint'(*nter 3he =o. o' $rime numbers to be count :)&

    scan'(d!n)&

    $rint'(nnibonacci =o.tPrime =o.)&

    +hile(count

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    12/45

    5etch()&

    2

    Practical /:

    Output:

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    13/45

    Practical ?:

    Source Code:

    #include

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    14/45

    #include

    int $o+er(int a! int b)&

    int $o+er(int a! int b)

    {

     int c1!i&

      'or(i1&i

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    15/45

    Practical -A:

    Source Code:

    #include

    #include

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    16/45

    lon5 'actorial(int n)

    {

    i'(n0)

    {

    return 1&

    2

    else

    {

    return n8'actorial(n-1)&

    2

    2

     void main()

     {

    int i!n&

    lon5 'act1&

    clrscr()&$rint'(*nter A no. 'rom 1 to 1: )&

    scan'(d!n)&

    'act'actorial(n)&

    $rint'(nd4ld!n!'act)&

    5etch()&

     2

    Practical -A:

    Output:

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    17/45

    Practical -9:

    Source Code:

    #include

    #include

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    18/45

    void Bbo(int!int)&

     void Bbo(int a! int b)

     {

      static int tem$&

      i'(tem$

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    19/45

    Practical :

    Source Code:

      #include

    #include

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    20/45

    #include

    struct cricet

    {

    char $name[0&

    char tname[0&

    int av5&

    2 $[0&

    void main()

    {

    char team[0[0!3eam[0&

    int i!"!enter!ltcount0!ttcount0!$laCercnt?&

    clrscr()&

    $rint'(*nter Dn'ormation ' dPlaCers:nn!$laCercnt)&

    'or(i0&i

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    21/45

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    22/45

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    23/45

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    24/45

    void main()

    {

    char 'n[/!mn[/!ln[/!stud[?0&

    int i!a0!"&

    clrscr()&

    $rint'(n*nter irst =ame: )&

    scan'(s!'n)&

    $rint'(n*nter 7iddle =ame: )&

    scan'(s!mn)&

    $rint'(n*nter Fast =ame: )&

    scan'(s!ln)&

    $rint'(nirst =ame: s!'n!n7iddle =ame:s!mn!nFast =ame: s!ln)&

      'or(i0&'n[i4G0G&i)

    {

    stud[a'n[i&

    a&

    2

    stud[aG G&

    a&

    'or(i0&mn[i4G0G&i)

    {

    stud[amn[i&

    a&

    2

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    25/45

    stud[aG G&

    a&

    'or(i0&ln[i4G0G&i)

    {

    stud[aln[i&

    a&

    2

    stud[aG0G&

    $rint'(nnull =ame:)&

    'or(i0&stud[i4G0G&i)

    {

    $rint'(c!stud[i)&

      2

    5etch()&2

    Practical E:

    Output:

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    26/45

    Practical H-A:

    Source Code:

    #include

    #include

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    27/45

    void main()

    {

    char str[0!substr[0!tem$[0&

      int i!"!!count0!res0&

      clrscr()&

    $uts(n*nter 3he Itrin5 : )&

    scan'(s!str)&

    $rint'(*nter 3he Iubstrin5 : )&

    scan'(s!substr)&

    'or(i0&substr[i4G0G&i)

      {

    count&2

      'or(i0&str[i4G0G&i)

      {

    'or(i0!i&"

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    28/45

    brea&

    2

    else

    {

    res1&

    2

    2

    i'(res>0)

    {

    $rint'(n Iubstrin5 7atched at location :d!i1)&

    brea&

    2

    2

    i'(res0)

    {

    $rint'(nnIubstrin5 =ot ound in 7ain strin54)&

    2

    5etch()&

    2

    Practical H-A:

    Output:

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    29/45

    Practical H-9:

    Source Code:

    #include

    #include

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    30/45

    void main()

    {

    int a0!i!"&

    char b[&

    clrscr()&

    $rint'(*nter 3he Itrin5 =umber: )&

    scan'(s!b)&

    'or(i0&b[i4G0G&i)

    {

    aa810&

     "b[i&

    s+itch(")

    {case K:

    aa0&

    brea&

    case L:

    aa1&

    brea&

    case 0:

    aa/&

    brea&

    case 1:

    aa?&

    brea&

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    31/45

    case /:

    aa&

    brea&

    case ?:

    aa&

    brea&

    case :

    aaE&

    brea&

    case :

    aaH&

    brea&

    case E:

    aaK&

    brea&

    case H:aaL&

    brea&

    case K:

    aa10&

    brea&

    case L:

    aa11&

    brea&

    Me'ault:

    $rint'(Dnvalid Itrin5 =umber4)&

    brea&

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    32/45

    2

     2

      $rint'(n 3he @alue in Dnte5er is d!a)&

      $rint'(nnt*5. A(d)i(d):d!a!i!ai)&

      5etch()&

    2

    Practical H-9:

    Output:

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    33/45

    Practical K:

    Source Code:

    #include

    #include

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    34/45

    void s+a$(int 8!int 8)&

    void s+a$(int 8,!int 8C)

    {

    int tem$&

    tem$8,&

    8,8C&

    8Ctem$&

    2

    void main()

    {

    int a!b&

    clrscr()&

    $rint'(n*nter @alue o' a: )&

    scan'(d!a)&

    $rint'(n*nter @alue o' b: )&

    scan'(d!b)&$rint'(nn3he ri5inal value o' a: d!a)&

    $rint'(n3he ri5inal value o' b: d!b)&

    s+a$(a!b)&

    $rint'(nnnI+a$$ed @alue o' a: d!a)&

    $rint'(nI+a$$ed @alue o' b: d!b)&

    5etch()&

    2

    Practical K:

    Output:

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    35/45

    Practical L:

    Source Code:

    #include

    #include

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    36/45

    void main()

    {

    int a[10!i!"!tem$!8b!8c&

    clrscr()&

    'or(i0&i

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    37/45

    b&

    2

      $rint'(nn3he smallest number in arraC is :d!a[0)&

    5etch()&

    2

    Practical L:

    Output:

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    38/45

    Practical 10-A:

    Source Code:

    #include

    #include

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    39/45

    void main()

    {

    char iBlename[;:63;69D=6DF*1.t,t&

    char oBlename[;:63;69D=6DF*/.t,t&

    char name[?0&

    int id&

    DF* 8o'$!8i'$&

    int c&

    clrscr()&

    i'$'o$en(iBlename!r)&

    o'$'o$en(oBlename!+)&

    +hile('scan'(i'$!ds!id!name)4*)

    {

    '$rint'(o'$!stdn!name!id)&2

    $rint'(3he ;ontent ' ile is co$ied)&

    'close(i'$)&

    'close(o'$)&

    5etch()&

    2

    Practical 10-A:

    Output:

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    40/45

    Practical 10-9:

    Source Code:

    #include

    #include

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    41/45

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    42/45

    Practical 10-;:

    Source Code:

    #include

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    43/45

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    44/45

    2

    5etch()&

    2

    Practical 10-;:

    Output:

  • 8/15/2019 C Journal Prints | Shree Ram College Bhandup

    45/45


Recommended