*Take 3 values from user and find the middle value among them.
Solution:
Solution:
#include <stdio.h>
int main() {
int a,b,c;
printf("Press 1st value:\n");
scanf("%d",&a);
printf("Press 2nd value:\n");
scanf("%d",&b);
printf("Press 3rd value:\n");
scanf("%d",&c);
if(a>b && a>c){
if(b>c){
printf("Your middle number is:%d\n",b);
}
else printf("Your middle number is:%d\n",c);
}
else if(b>a && b>c){
if(a>c){
printf("Your middle number is:%d\n",a);
}
else printf("Your middle number is:%d\n",c);
}
else if(c>a && c>b){
if(a>b){
printf("Your middle number is:%d\n",a);
}
else printf("Your middle number is:%d\n",b);
}
return 0;
}
Post a Comment