All programsvfvdfvddfvfdvdfvfdvfdv dvdsvsdvvsdvsvdvsdv dsvdsv PDF

Title All programsvfvdfvddfvfdvdfvfdvfdv dvdsvsdvvsdvsvdvsdv dsvdsv
Author Anonymous User
Course computer science
Institution G.Narayanamma Institute of Technology & Science
Pages 24
File Size 714.2 KB
File Type PDF
Total Downloads 22
Total Views 157

Summary

dfbdfbdfbdfbdfbfbdfbfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbbbbbbbbbbbbbbbbb dfff...


Description

Prog1 : Write a program to find addition of two numbers. #include #include void main() { int a,b,c; printf("\nEnter values of a and b:\n"); scanf("%d%d",&a,&b); c=a+b; printf("Addition=%d",c); getch(); } Output

Prog.2 :Write a program to calculate the area of circle. #include #include void main() { float r,area,pie=3.14; printf("\nEnter the radius of the circle:\n"); scanf("%f",&r); area=pie*r*r; printf("Area of circle is%f",area); getch(); }

Output

Prog.3 : Write a program to calculate the circumference of circle. #include #include void main() { float r,circumference,pie=3.14; printf("\nEnter the radius of the circle\n"); scanf("%f",&r); circumference=2*pie*r; printf("Circumerence of circle is%f",circumference); getch(); }

Output

Prog.4 : Write a program to print days of week using switch statement. #include #include void main() { int n; printf("\nEnter a number:\n"); scanf("%d",&n); switch(n) { case 1: printf("Sunday"); break; case 2: printf("Monday"); break; case 3: printf("Tuesday"); break; case 4: printf("Wednesday"); break; case 5: printf("Thursday"); break;

case 6: printf("Friday"); break; case 7: printf("Saturday"); break; case 8: printf("Sunday"); break; default: printf("Invalid Input"); break; } getch(); }

Output

Prog.5 : Write a program to find the difference between two numbers. #include #include void main() { int a,b,c; printf("\nEnter values of a and b:\n"); scanf("%d%d",&a,&b); c=a-b; printf("Difference=%d",c); getch(); }

Output

Prog.6 : Write a program to find Division of two numbers. #include #include void main() { int a,b,c; printf("\nEnter the values of a and b:\n"); scanf("%d%d",&a,&b); c=a/b; printf("Division=%d",c); getch(); } Output

Prog.7 : Write a program to find the greatest of three numbers. #include #include void main() { int a,b,c; printf("Enter three numbers:\n"); scanf("%d%d%d",&a,&b,&c); if(a>b&&a>c) printf("%d is the greatest",a); else if(b>a&&b>c) printf("%d is the greatest",b); else { printf("%d is the greatest",c); } getch(); } Output

Prog.8: Using switch statement print months of the year. #include #include void main() {

int a; printf("Enter a number:\n"); scanf("%d",&a); switch(a)

{

case 1: printf("January"); break; case 2: printf("Febrauary"); break; case 3: printf("March"); break; case 4: printf("April"); break; case 5: printf("May"); break; case 6:

printf("June"); break; case 7: printf("July"); break; case 8: printf("August"); break; case 9: printf("September"); break; case 10: printf("October"); break; case 11: printf("November"); break; case 12: printf("December"); break; default: printf("Invalid Input"); break; } getch(); }

Output

Prog.9: Write a program to find the multiplication of two numbers. #include #include void main() { int a,b,c; printf("\nEnter values of a and b:\n"); scanf("%d%d",&a,&b); c=a*b; printf("Multiplication=%d",c); getch(); } Output

Prog.10 : Write a program to find the number is even or odd. #include #include void main() { int a; printf("Enter a number:\n"); scanf("%d",&a); if(a%2==0) printf("Number is even\n"); else printf("Number is odd\n"); getch(); }

Output

Prog.11 : Write a program to find out bonus on salary. #include #include void main() { float salary; printf("Enter your salary:\n"); scanf("%f",&salary); if(salary=10000&&salary=20000&&salary...


Similar Free PDFs