C programs neede befoe start of ACC Programs

1. Addition of two integer/float numbers.
2. Find the area of circle.
3. Calculate average of three numbers.
4. Check whether number is even or not.
5. Check whether character is vowel or consonant.
6. Check whether number is positive or negative.
7. Determine FIRST CLASS/SECOND CLASS/DISTINCTION for 5 subjects.
8. Switch case program for addition subtraction multiplication and division.
9. Switch case program for areas of circle,rectangle and triangle.
10. Calculate and display even number from 1 to 100 using for loop
11. Calculate and display even number from 1 to 100 using while loop.
12. Counting positive,negative and zeros from given list of numbers.
13. Program for displaying values from array.(Take values from program)
14. Program for displaying values from array.(Take values from user)
15. Addition of numbers in 1D array.
16. Displaying 2D array by taking numbers from program.
17. Displaying 2D array by taking numbers from user.
18. Addition of numbers in two different 2D arrays.
19. Display name of book,pages and price using structure.
20. Display name,salary,conatct no, mail id of employee using structure.
21. Display name of book,pages and price using array of structure.
22. Display name,salary,conatct no, mail id of employee using array of structure.
23. Display name,salary,conatct no, mail id of employee using union.
24. Multiplication of numbers using pointer.
25. Write a program to demonstrate the use of pointer to pointer
26. Display name of book,pages and price using pointer to structure.
27.Write a program to display content of file.
28. Copy the content of one file from the other file and display the contents.
29. Display content of string character by charatcter.
30. Find and display string length without using string function.
31. Copying content of string in another string without using string function.
32. Display reverse string without using string function.
33. Find and display number of vowels and consonants in the string.
34. Display array of string by taking from user.
35. Program to demonstrate string functions using switch case.
36. Multiplication of two number using pointer.
37. Display size of pointer.
38. Program to demonstrate pointer to structure .
39. Program to demonstrate Array of pointer.
40. Display string length using pointer.

Comments

  1. sanjivani atakare1:18 PM

    #include

    void main()
    {
    int a,b,c;
    printf("\n\tEnter two number:");
    scanf("%d%d",&a,&b);
    c=a+b;
    printf("addition of two number=%d",c);

    }

    ReplyDelete
  2. sanjivani atakare1:21 PM

    #include
    #define pi 3.14
    void main()
    {
    float area,r;
    printf("enter the radius");
    scanf("%f",&r);
    area=pi*r*r;
    printf("\n\t Area of circle=%f",area);
    }

    ReplyDelete
  3. sanjivani atakare1:22 PM

    #include
    void main()
    {
    float avg,a,b,c;
    printf("\n\t Enter the three values");
    scanf("%f%f%f",&a,&b,&c);
    avg=((a+b+c)/3);
    printf("\n\tAverage=%f",avg);
    }

    ReplyDelete
  4. sanjivani atakare1:24 PM

    #include

    void main()
    {
    int a;
    printf("\n\tEnter a number");
    scanf("%d",&a);
    if(a%2==0)
    {
    printf("\nno is even");
    }
    else
    {
    printf("\n\tno is odd");
    }
    }

    ReplyDelete
  5. sanjivani atakare1:25 PM

    #include
    void main()
    {
    char ch;
    printf("\n\tEnter a character");
    scanf("%c",&ch);
    if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
    {
    printf("\n\t VOWELL");
    }
    else
    {
    printf("\n\t CONSONANT");
    }
    }

    ReplyDelete
  6. sanjivani atakare1:28 PM

    #include
    void main()
    {
    int num;
    printf("\n\tenter a number");
    scanf("%d",&num);
    if(num>0)
    {
    printf("\n\t positive no");
    }
    if(num<0)
    {
    printf("\n\t negative no");
    }
    if(num==0)
    {
    printf("\n\t zero no");
    }
    }

    ReplyDelete
  7. sanjivani atakare1:31 PM

    #include
    #define pi 3.14
    void main()
    {
    int ch;
    float r,l,b,h;
    printf("\n1.Area of Circle\n2. Area of Triangle\n3.Area of Rectangle");
    printf("\nEnter your choice:");
    scanf("%d",&ch);
    switch(ch)
    {
    case 1:
    printf("Enter radius:");
    scanf("%f",&r);
    printf("Area of Circle=%f",pi*r*r);
    break;

    case 2:
    printf("Enter a length and breadth:");
    scanf("%f%f",&l,&b);
    printf("Area of Triangle=%f",l*b);
    break;

    case 3:
    printf("Enter a length, breadth, hight:");
    scanf("%f%f%f",&l,&b,&h);
    printf("Area of Rectangle=%f",l*b*h);
    break;
    }

    }

    ReplyDelete
  8. sushmita swami11:28 AM

    /* information of book */
    #include
    void main()
    {
    struct book;
    {
    char name[10];
    float price;
    int pages;
    }b;
    printf("enter the name of book");
    scanf("%s",b.book name);
    printf("enter the price of book");
    scanf("%f",b.price);
    printf("enter the pages of book");
    scanf("%d",&b.pages);
    }
    printf("\n\t book name=%s,book price=%f,book pages=%d,",b.name,b.price.,b.pages);

    ReplyDelete
  9. sushmita swami11:59 AM

    \* area of circle*\
    # include
    #define pi 3.14
    void main()
    {
    inr r;
    float area;
    printf("\n\t enter the radious");
    scanf("%d",&r);
    area=pi*r*r;
    printf("\n\t area of circle=%f",area);
    }

    ReplyDelete
  10. a k sawant12:07 PM

    #include
    #define pi 3.14
    void main()
    {
    float area,r;
    printf("enter the radius");
    scanf("%f",&r);
    area=pi*r*r;
    printf("\n\tarea of circle=%f",area);
    }

    ReplyDelete
  11. sushmita swami12:24 PM

    #include
    void main()
    {
    int a,b,c;
    printf("\n\t enter the two number");
    scanf("%d%d",&a,&b);
    c=a+b;
    printf("addition=%d",&c);
    }

    ReplyDelete
  12. a k sawant12:32 PM

    #include

    void main()
    {
    char ch;

    printf("Enter a character");
    scanf("%c",&ch);

    if(ch=='a'|| ch=='e'|| ch=='i'|| ch=='o'|| ch=='u')
    {
    printf("vowel");
    }
    else
    {
    printf("consonant");
    }

    }

    ReplyDelete
  13. a k sawant12:34 PM

    #include

    void main()
    {
    int x,y,temp;

    printf("Enter values of x & y\n");
    scanf("%d%d,&x,&y);

    printf("Before swapping\nx=%d\ny=%d\n",x,y);

    temp=x;
    x=y;
    y=temp;

    printf("After swapping\nx=%d\ny=%d\n"x,y);

    }

    ReplyDelete
  14. m m nalawade9:16 AM

    #include
    void main()
    {
    float avg,a,b,c;
    printf("\n\tenter the three values");
    scanf("%f%f%f",&a,&b,&c);
    avg=((a+b+c)/3);
    printf("/n/taverage=%f",avg);
    }

    ReplyDelete
  15. a k sawant9:20 AM

    #include

    void main()
    {
    int x,y,temp;

    printf("Enter values of x & y\n");
    scanf("%d%d,&x,&y);

    printf("Before swapping\nx=%d\ny=%d\n",x,y);

    temp=x;
    x=y;
    y=temp;

    printf("After swapping\nx=%d\ny=%d\n"x,y);

    }

    ReplyDelete
  16. a k sawant10:00 AM

    #include
    void main()
    {
    struct book
    {
    char name[10];
    int pages;
    float price;
    }b;

    printf("\n\t Enter name of book");
    scanf("%s",b.name);

    printf("\n\t Enter price of book");
    scanf("%f",&b.price);

    printf("\n\t Enter pages of book");
    scanf("%d",&b.pages);

    printf("\n\t book name=%s,book price=%f,book pages=%d",b.name,b.price,b.pages);

    }

    ReplyDelete
  17. sanjivani atakare3:50 PM

    #include
    void main()
    {
    int a[5]={5,10,15,20,25};
    int j;


    for(j=0;j<=4;j++)
    {


    printf("\n\t%d",a[j]);
    }
    }

    ReplyDelete
  18. sanjivani atakare3:56 PM

    #include
    void main()
    {
    int a[2],b[2],c[2];
    int i;
    printf("\n\tEnter the elements of first array:");
    for(i=0;i<=1;i++)
    {


    scanf("%d",&a[i]);
    }
    printf("\n\tEnter the elements of second array:");
    for(i=0;i<=1;i++)
    {


    scanf("%d",&b[i]);
    }
    printf("\n\tAddition of two array elements=");
    for(i=0;i<=1;i++)
    {
    c[i]=a[i]+b[i];
    printf("\n\taddition=%d",c[i]);

    }
    }

    ReplyDelete
  19. sanjivani atakare3:57 PM

    #include
    void main()
    {
    int a[2][2]={
    {5,10},
    {15,20},
    };
    int j,i;


    for(j=0;j<=1;j++)
    {
    for( i=0;i<=1;i++)
    {

    printf("\n\t%d",a[j][i]);
    }
    }
    }

    ReplyDelete
  20. sanjivani atakare4:00 PM

    #include
    void main()
    {
    struct book
    {
    char name[10];
    float price;
    int pages;
    }b;
    printf("\n\tEnter the name of book");
    scanf("%s",b.name);
    printf("\n\tEnter the price of book");
    scanf("%f",&b.price);
    printf("\n\tEnter the pages of book");
    scanf("%d",&b.pages);


    printf("\n\tBook Name=%s,Book Price=%f,Book Pages=%d",b.name,b.price,b.pages);
    }

    ReplyDelete
  21. sanjivani atakare4:01 PM

    #include
    void main()
    {
    struct book1
    {
    char name[10];
    float price;
    int pages;
    }b[10];
    int i;
    for(i=0;i<=9;i++)
    {
    printf("\n\tEnter the name of boot\n\t");
    scanf("%s",b[i].name);
    printf("\n\tEnter the price of book\n\t");
    scanf("%f",&b[i].price);
    printf("\n\tEnter the pages of book\n\t");
    scanf("%d",&b[i].pages);
    }
    for(i=0;i<=9;i++)
    {
    printf("\n\tBook Name=%s\n\tBook Price=%f\n\tBook Pages=%d",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  22. sanjivani atakare4:06 PM

    #include
    void main()
    {
    struct book1
    {
    char name[10];
    float price;
    int pages;
    }b[10];
    int i;
    for(i=0;i<=9;i++)
    {
    printf("\n\tEnter the name of boot\n\t");
    scanf("%s",b[i].name);
    printf("\n\tEnter the price of book\n\t");
    scanf("%f",&b[i].price);
    printf("\n\tEnter the pages of book\n\t");
    scanf("%d",&b[i].pages);
    }
    for(i=0;i<=9;i++)
    {
    printf("\n\tBook Name=%s\n\tBook Price=%f\n\tBook Pages=%d",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  23. sanjivani atakare4:07 PM

    #include
    void main()
    {
    int a[2][2],b[2][2],c[2][2];
    int i,j;
    printf("\n\tEnter the elements of first array:");
    for(i=0;i<=1;i++)
    {
    for(j=0;j<=1;j++)
    {

    scanf("%d",&a[i][j]);
    }
    }
    printf("\n\tEnter the elements of second array:");
    for(i=0;i<=1;i++)
    {
    for(j=0;j<=1;j++)
    {

    scanf("%d",&b[i][j]);
    }
    }
    printf("\n\tAddition of two arrat elements=");
    for(i=0;i<=1;i++)
    {
    for(j=0;j<=1;j++)
    {
    c[i][j]=a[i][j]+b[i][j];
    printf("\n\taddition=%d",c[i][j]);
    }

    }
    }

    ReplyDelete
  24. sanjivani atakare4:26 PM

    #include
    void main()
    {
    struct employee
    {
    char name[10];
    float salary;
    int id;
    int contactno;
    }e;
    printf("\n\tEnter the name of employee");
    scanf("%s",e.name);
    printf("\n\tEnter the salary of employee");
    scanf("%f",&e.salary);
    printf("\n\tEnter the id of employee");
    scanf("%d",&e.id);
    printf("\n\tEnter the contactno of employee");
    scanf("%d",&e.contactno);


    printf("\n\tEmployee Name=%s,Employee salary=%f,Employee id=%d,Contactno=%d",e.name,e.salary,e.id,e.contactno);
    }

    ReplyDelete
  25. sanjivani atakare4:32 PM

    #include
    void main()
    {
    struct emp
    {
    char name[50];
    float salary;
    int id;
    int contactno;
    }e[10];
    int i;
    for(i=0;i<=9;i++)
    {
    printf("\n\tEnter the name of employee\n\t");
    scanf("%s",e[i].name);
    printf("\n\tEnter the salary of employee\n\t");
    scanf("%f",&e[i].salary);
    printf("\n\tEnter the id of employee\n\t");
    scanf("%d",&e[i].id);
    printf("\n\tEnter the contactno of employee");
    scanf("%d",&e[i].contactno);
    }
    for(i=0;i<=9;i++)
    {


    printf("\n\tEmployee Name=%s,Employee salary=%f,Employee id=%d,Contactno=%d",e[i].name,e[i].salary,e[i].id,e[i].contactno);
    }
    }

    ReplyDelete
  26. sanjivani atakare4:41 PM

    #include
    void main()
    {
    union emp
    {
    char name[50];
    float salary;
    int id;
    int contactno;
    }u[10];
    int i;
    for(i=0;i<=9;i++)
    {
    printf("\n\tEnter the name of employee\n\t");
    scanf("%s",u[i].name);
    printf("\n\tEnter the salary of employee\n\t");
    scanf("%f",&u[i].salary);
    printf("\n\tEnter the id of employee\n\t");
    scanf("%d",&u[i].id);
    printf("\n\tEnter the contactno of employee");
    scanf("%d",&u[i].contactno);
    }
    for(i=0;i<=9;i++)
    {


    printf("\n\tEmployee Name=%s,Employee salary=%f,Employee id=%d,Contactno=%d",u[i].name,u[i].salary,u[i].id,u[i].contactno);
    }
    }

    ReplyDelete
  27. sanjivani atakare4:46 PM

    #include
    void main()
    {
    int i=1;
    while(i<=100)
    {
    if(i%2==0)
    {
    printf("%d\n\t",i);
    }
    i++;
    }
    }

    ReplyDelete
  28. sanjivani atakare4:55 PM

    #include
    void main()
    {
    int a,b;
    int *ptr1,*ptr2;
    ptr1=&a;
    ptr2=&b;
    printf("\n\tEnter two no");
    scanf("%d%d",&a,&b);
    printf("mul=%d",(*ptr1)*(*ptr2));
    }

    ReplyDelete
  29. a k sawant12:49 PM

    /*To display the information of book using array of stucture*/
    #include
    void main()
    {
    int i;
    struct book
    {
    char name[100];
    float price;
    int pages;
    }b[5];

    for(i=0;i<=4;i++)
    {
    printf("\n\tEnter the name of book");
    scanf("%s",b[i].name);

    printf("\n\tEnter the price of book");
    scanf("%f",&b[i].price);

    printf("\n\tEnter the pages of book");
    scanf("%d",&b[i].pages);
    }

    for(i=0;i<=4;i++)
    {
    printf("\n\tNAME=%s \n\tPRICE=%f \n\tPAGES=%d",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  30. mm nalawade12:52 PM

    #include

    void main()
    {
    int x,y,temp;

    printf("Enter values of x & y\n");
    scanf("%d%d,&x,&y);

    printf("Before swapping\nx=%d\ny=%d\n",x,y);

    temp=x;
    x=y;
    y=temp;

    printf("After swapping\nx=%d\ny=%d\n"x,y);

    }

    ReplyDelete
  31. mm nalawade12:54 PM

    #include

    void main()
    {
    char ch;

    printf("Enter a character");
    scanf("%c",&ch);

    if(ch=='a'|| ch=='e'|| ch=='i'|| ch=='o'|| ch=='u')
    {
    printf("vowel");
    }
    else
    {
    printf("consonant");
    }

    }

    ReplyDelete
  32. sanjivani atakare3:51 PM

    #include
    void main()
    {
    struct book
    {
    char name[10];
    float price;
    int pages;

    }b;
    struct book *p;
    p=&b;
    printf("\n\tEnter the book name");
    scanf("%s",p->name);
    printf("\n\tEnter the price name");
    scanf("%f",&p->price);
    printf("\n\tEnter the pages name");
    scanf("%d",&p->pages);

    printf("\n\tBook name=%s,Book price=%f,Book pages=%d",p->name,p->price,p->pages);
    }

    ReplyDelete
  33. a k sawant11:12 AM

    /*To calculate Average of three numbers ,20-7-16*/
    #include
    void main()
    {
    int a,b,c;
    float avg;
    printf("\n\tEnter the first number");
    scanf("%d",&a);
    printf("\n\tEnter the second number");
    scanf("%d",&b);
    printf("\n\tEnter the third number");
    scanf("%d",&c);
    avg=a+b+c/3;
    printf("\n\tavg=%f",avg);
    }

    ReplyDelete
  34. a k sawant11:14 AM

    /*To accept two different array & make their addition*/
    #include
    void main()
    {
    int i,j,a[2][2],b[2][2],c[2][2];
    printf("\n\tEnter the elements of first 2D array");
    for(i=0;i<=1;i++)
    {
    for(j=0;j<=1;j++)
    {
    scanf("\n\t%d",&a[i][j]);
    }
    }
    printf("\n\tEnter the elements of second 2D array");
    for(i=0;i<=1;i++)
    {
    for(j=0;j<=1;j++)
    {
    scanf("\n\t%d",&b[i][j]);
    }
    }
    for(i=0;i<=1;i++)
    {
    for(j=0;j<=1;j++)
    {
    c[i][j]=a[i][j]+b[i][j];
    printf("\n\tAddition=%d",c[i][j]);
    }
    }
    }

    ReplyDelete
  35. a k sawant11:16 AM

    /*To display the information of book using array of stucture*/
    #include
    void main()
    {
    int i;
    struct book
    {
    char name[100];
    float price;
    int pages;
    }b[5];

    for(i=0;i<=4;i++)
    {
    printf("\n\tEnter the name of book");
    scanf("%s",b[i].name);

    printf("\n\tEnter the price of book");
    scanf("%f",&b[i].price);

    printf("\n\tEnter the pages of book");
    scanf("%d",&b[i].pages);
    }

    for(i=0;i<=4;i++)
    {
    printf("\n\tNAME=%s \n\tPRICE=%f \n\tPAGES=%d",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  36. a k sawant11:17 AM

    /*Addition of two numbers in 1D array*/
    #include
    void main()
    {
    int i,a[5],b[5],c[5];
    printf("\n\tEnter the elements of first array");
    for(i=0;i<=4;i++)
    {
    scanf("%d",&a[i]);
    }
    printf("\n\tEnter the elements of second array");
    for(i=0;i<=4;i++)
    {
    scanf("%d",&b[i]);
    }
    for(i=0;i<=4;i++)
    {
    c[i]=a[i]+b[i];
    printf("\n\tAddition=%d",c[i]);
    }
    }

    ReplyDelete
  37. a k sawant11:18 AM

    /*To display 2D array*/
    #include
    void main()
    {
    int i,j;
    int a[2][2]={ {5,10},
    {15,20}};
    for(i=0;i<=1;i++)
    {
    for(j=0;j<=1;j++)
    {
    printf("a[%d][%d]=%d",i,j,a[i][j]);
    }
    }
    }

    ReplyDelete
  38. a k sawant11:23 AM

    /*To display 2D array by taking the values from user*/
    #include
    void main()
    {
    int i,j,a[2][2];
    printf("\n\tEnter the elements of array:");
    for(i=0;i<=1;i++)
    {
    for(j=0;j<=1;j++)
    {
    scanf("\n\t%d",&a[i][j]);
    }
    }
    for(i=0;i<=1;i++)
    {
    for(j=0;j<=1;j++)
    {
    printf("\n\t%d",a[i][j]);
    }
    }
    }

    ReplyDelete
  39. a k sawant11:26 AM

    /*To display the array,take values from user*/
    #include
    void main()
    {
    int i;
    int a[5];
    printf("\n\tEnter the elements of array");
    for(i=0;i<=4;i++)
    {
    scanf("\n\t%d",&a[i]);
    }
    for(i=0;i<=4;i++)
    {
    printf("\n\t%d",a[i]);
    }
    }

    ReplyDelete
  40. a k sawant11:27 AM

    /*To display even number from 1to 10 by using while loop,20-7-16*/
    #include
    void main()
    {
    int i=1;
    while(i<=10)
    {
    if(i%2==0)
    {
    printf("%d",i);
    }
    i++;
    }
    }

    ReplyDelete
  41. a k sawant11:28 AM

    /*To calculate display even number from 1to 100 by using while loop,20-7-16*/
    #include
    void main()
    {
    int i=1;
    while(i<=100)
    {
    if(i%2==0)
    {
    printf("%d",i);
    }
    i++;
    }
    }

    ReplyDelete
  42. a k sawant11:29 AM

    /*To calculate and display even number from 1 to 100 by using for loop*/
    #include
    void main()
    {
    int i=1;
    for(i=1;i<=100;i++)
    {
    if(i%2==0)
    {
    printf(" \n Given no %d is even \n ",i);
    }

    }

    }

    ReplyDelete
  43. a k sawant11:30 AM

    /*To displaying values from array*/
    #include
    void main()
    {
    int a[5]={1,2,3,4,5},i;
    for(i=0;i<=4;i++)
    {
    printf("\n\t%d",a[i]);
    }
    }

    ReplyDelete
  44. a k sawant11:32 AM

    /*To displaying values from array*/
    #include
    void main()
    {
    int a[5]={1,2,3,4,5},i;
    for(i=0;i<=4;i++)
    {
    printf("\n\t%d",a[i]);
    }
    }

    ReplyDelete
  45. a k sawant11:32 AM

    #include
    void main()
    {
    struct employe
    {
    char name[10];
    float salary;
    int id;
    }e;

    printf("\n\t Enter name of employe");
    scanf("%s",&e.name);

    printf("\n\t Enter salary of employe");
    scanf("%f",&e.salary);

    printf("\n\t Enter id of employe");
    scanf("%d",&e.id);

    printf("\n\t employe name=%s,employe salary=%f,employe id=%d",e.name,e.salary,e.id);

    }

    ReplyDelete
  46. a k sawant11:34 AM

    /*To calculate Average of three numbers */
    #include
    void main()
    {
    int a,b,c;
    float avg;
    printf("\n\tEnter the first number");
    scanf("%d",&a);
    printf("\n\tEnter the second number");
    scanf("%d",&b);
    printf("\n\tEnter the third number");
    scanf("%d",&c);
    avg=a+b+c/3;
    printf("\n\tavg=%f",avg);
    }

    ReplyDelete
  47. a k sawant11:35 AM

    #include
    void main()
    {
    int num,cnt1,cnt2,cnt3;
    int i;
    for(i=1;i<=5;i++)
    {
    printf("\n\tEnter the num");
    scanf("%d",&num);
    if(num>0)
    cnt1++;
    if(num<0)
    cnt2++;
    if(num==0)
    cnt3++;
    }
    }
    printf(Total positive);
    }

    ReplyDelete
  48. mm nalawade11:36 AM

    /*To accept two different array & make their addition*/
    #include
    void main()
    {
    int i,j,a[2][2],b[2][2],c[2][2];
    printf("\n\tEnter the elements of first 2D array");
    for(i=0;i<=1;i++)
    {
    for(j=0;j<=1;j++)
    {
    scanf("\n\t%d",&a[i][j]);
    }
    }
    printf("\n\tEnter the elements of second 2D array");
    for(i=0;i<=1;i++)
    {
    for(j=0;j<=1;j++)
    {
    scanf("\n\t%d",&b[i][j]);
    }
    }
    for(i=0;i<=1;i++)
    {
    for(j=0;j<=1;j++)
    {
    c[i][j]=a[i][j]+b[i][j];
    printf("\n\tAddition=%d",c[i][j]);
    }
    }
    }

    ReplyDelete
  49. mm nalawade11:38 AM

    #include
    void main()
    {
    float avg,a,b,c;
    printf("\n\tenter the three values");
    scanf("%f%f%f",&a,&b,&c);
    avg=((a+b+c)/3);
    printf("/n/taverage=%f",avg);
    }

    ReplyDelete
  50. mm nalawade11:39 AM

    /*Addition of two numbers in 1D array*/
    #include
    void main()
    {
    int i,a[5],b[5],c[5];
    printf("\n\tEnter the elements of first array");
    for(i=0;i<=4;i++)
    {
    scanf("%d",&a[i]);
    }
    printf("\n\tEnter the elements of second array");
    for(i=0;i<=4;i++)
    {
    scanf("%d",&b[i]);
    }
    for(i=0;i<=4;i++)
    {
    c[i]=a[i]+b[i];
    printf("\n\tAddition=%d",c[i]);
    }
    }

    ReplyDelete
  51. mm nalawade11:41 AM

    /*To calculate Average of three numbers ,20-7-16*/
    #include
    void main()
    {
    int a,b,c;
    float avg;
    printf("\n\tEnter the first number");
    scanf("%d",&a);
    printf("\n\tEnter the second number");
    scanf("%d",&b);
    printf("\n\tEnter the third number");
    scanf("%d",&c);
    avg=a+b+c/3;
    printf("\n\tavg=%f",avg);
    }

    ReplyDelete
  52. mm nalawade11:42 AM

    /*To display the information of book using array of stucture*/
    #include
    void main()
    {
    int i;
    struct book
    {
    char name[100];
    float price;
    int pages;
    }b[5];

    for(i=0;i<=4;i++)
    {
    printf("\n\tEnter the name of book");
    scanf("%s",b[i].name);

    printf("\n\tEnter the price of book");
    scanf("%f",&b[i].price);

    printf("\n\tEnter the pages of book");
    scanf("%d",&b[i].pages);
    }

    for(i=0;i<=4;i++)
    {
    printf("\n\tNAME=%s \n\tPRICE=%f \n\tPAGES=%d",b[i].name,b[i].price,b[i].pages);
    }
    }

    ReplyDelete
  53. mm nalawade11:43 AM

    /*To calculate display even number from 1to 100 by using while loop,20-7-16*/
    #include
    void main()
    {
    int i=1;
    while(i<=100)
    {
    if(i%2==0)
    {
    printf("%d",i);
    }
    i++;
    }
    }

    ReplyDelete
  54. mm nalawade11:44 AM

    /*To calculate and display even number from 1 to 100 by using for loop*/
    #include
    void main()
    {
    int i=1;
    for(i=1;i<=100;i++)
    {
    if(i%2==0)
    {
    printf(" \n Given no %d is even \n ",i);
    }

    }

    }

    ReplyDelete
  55. mm nalawade11:46 AM

    #include
    struct employee
    {
    char name[20],mail[20];
    int contact;
    float salary;
    }e[100];

    void main()
    {
    int n,i;
    printf("\n\nenter the number of employees\n");
    scanf("%d",&n);
    for(i=0;i<=n-1;i++)
    {
    printf("\nEnter contact no.\n ");
    scanf("%d",&e[i].contact);
    printf("\nenter the name of employee\n");
    scanf("%s",e[i].name);
    printf("\nEnter salary of employee\n ");
    scanf("%f",&e[i].salary);
    printf("\nEnter mail id\n");
    scanf("%s",e[i].mail);

    }

    printf("name\tcontact no\tsalary\tmail id\n");
    printf("-------------------------------------------------\n");
    for(i=0;i<=n-1;i++)
    {
    printf("\n%s\t%d\t%f\t%s\t",e[i].name,e[i].contact,e[i].salary,e[i].mail);
    }
    }

    ReplyDelete
  56. mm nalawade11:47 AM

    #include

    void main()
    {
    float per;

    printf("Enter your percentage");
    scanf("%f",&per);

    if(per>=60)
    {
    printf("First class");
    }
    else if(per>=50)
    {
    printf("Second class");
    }
    else if(per>=40)
    {
    printf("Thrid Class");
    }
    else
    {
    printf("Fail");
    }

    }

    ReplyDelete
  57. mm nalawade11:48 AM

    #include

    void main()
    {
    int x,y,temp;

    printf("Enter values of x & y\n");
    scanf("%d%d,&x,&y);

    printf("Before swapping\nx=%d\ny=%d\n",x,y);

    temp=x;
    x=y;
    y=temp;

    printf("After swapping\nx=%d\ny=%d\n"x,y);

    }

    ReplyDelete
  58. mm nalawade11:50 AM

    /*To calculate display even number from 1to 100 by using while loop,20-7-16*/
    #include
    void main()
    {
    int i=1;
    while(i<=100)
    {
    if(i%2==0)
    {
    printf("%d",i);
    }
    i++;
    }
    }

    ReplyDelete
  59. mm nalawade8:41 AM

    #include
    void main()
    {
    struct book
    {
    char name[10];
    float price;
    int pages;
    }b;
    struct book *p;
    p=&b;
    printf("enter name of book");
    scanf("%s",p->name);
    printf("enter price of book");
    scanf("%f",&p->price);
    printf("enter pages of book");
    scanf("%d",&p->pages);
    printf("book name=%s,book price=%f,book pages=%d,p->name,p->price,p->pages");
    }

    ReplyDelete
  60. a k sawant9:19 AM

    #include

    void main()
    {
    int ch,add,sub,mul,div,a,b;

    printf("Enter the number 1..");
    scanf("%d",&a);

    printf("Enter the number 2..");
    scanf("%d",&b);

    printf("Choose option to perform operation.....\n1..Addition \n2..Subtraction \n3..Multiplication \n4..Division \n");
    printf("\nEnter......");
    scanf("%d",&ch);

    switch(ch)
    {
    case 1:add=a+b;
    printf("\nADDITION=%d\n",add);
    break;

    case 2:sub=a-b;
    printf("\nSUBTRACTION=%d\n",sub);
    break;

    case 3:mul=a*b;
    printf("\nMULTIPLICATION=%d\n",mul);
    break;

    case 4:div=a/b;
    printf("\nDIVISION=%d\n",div);
    break;

    default:
    printf("\nPlease enter valid option.........\n\nRun Again...........\n");
    break;
    }
    }

    ReplyDelete
  61. mm nalawade9:40 AM

    /* Area of circle, triangle,rectangle using switch case*/
    #include
    #define pi 3.14
    void main()
    {
    int ch;
    float r,l,b,h;
    printf("\n1.Area of circle\n2.Area of Rectangle\n3.Area of Triangle\n");
    printf("\nEnter your choice:");
    scanf("%d",&ch);
    switch(ch)
    {
    case 1:
    printf("\nEnter a radius:");
    scanf("%f",&r);
    printf("\nArea of circle=%f\n",(pi*r*r));
    break;
    case 2:
    printf("\nEnter a length and breadth:");
    scanf("%f%f",&l,&b);
    printf("\nArea of Rectangle=%f\n",(l*b));
    break;
    case 3:
    printf("\nEnter a base,height:");
    scanf("%f%f%f",&l,&b,&h);
    printf("\nArea of Triangle=%f\n",(0.5*b*h));
    break;
    default:
    printf("\nWrong choice:\n");
    }


    }

    ReplyDelete

Post a Comment