// Write a program to enter mark of 5 subjects & calculate total mark and percentage. #include<stdio.h> #include<conio.h> void main() { int a,b,c,d,e; float per,total=0; clrscr(); printf("Enter marks of five subject:\n"); scanf("%d%d%d%d%d",&a,&b,&c,&d,&e); total=a+b+c+d+e; per=total/5; printf("Total marks = %f",total); printf("Total percentage = %f",per); getch(); }
// WAP to enter three numbers and find middle number among them. #include<stdio.h> #include<conio.h> void main ( ) { int a , b , c ; clrscr ( ) ; printf ( "Enter three number: \n " ) ; scanf ( "%d%d%d" ,& a ,& b ,& c ) ; if ( ( a > b && a < c ) || ( a > c && a < b ) ) printf ( "%d is middle number" , a ) ; else if ( ( b > a && b < c ) || ( b > c && b < a ) ) printf ( "%d is middle number" , b ) ; else printf ( "%d is middle number" , c ) ; getch ( ) ; } Output:
Comments
Post a Comment