- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 3
- Posts with Upvotes
- 2
- Upvoting Members
- 3
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
hi, this is the code: #include <stdio.h> main() { int m1, m2, m3, m4, m5, per; printf("Enter marks in five subjects\n"); scanf("%d%d%d%d%d",&m1,&m2,&m3,&m4,&m5); per=(m1+m2+m3+m4+m5)/5; if(per>=60) printf("first division\n"); if((per>=50) && (per<60)) printf("second division\n"); if((per>=40) && (per<50)) printf("third division\n"); if(per<40) printf("fail\n"); } this is the output for: [root@localhost lbin]# gcc -o division division.c … | |
hi, this is the code for switch:[CODE] include <stdio.h> main() { int i=2; switch(i) { case 1; printf("i am in case 1\n"); break; case 2; printf("i am in case 2\n"); break; case 3; printf("i am in case 3\n"); break; default; printf("i am in default\n"); } }[/CODE] and this is the … | |
hi, This is the code to be changed to conditional operators: #include <stdio.h> main() { int x, min, max; printf("Enter val for max and x\n"); scanf("\n%d%d",&max,&x); if(x>max) min=max; else min=x; printf("%d\n",min); } the above code is runing but problem is when changed to conditional operators: #include <stdio.h> main() { int … |