First Method:
#include<stdio.h>
void main(){
int a,b,c;
printf("Enter 3 numbers which you want to check: ");
scanf("%d%d%d",&a,&b,&c);
if(a>b && a>c){
printf("%d is greater",a);
}
else if(b>c && b>a){
printf("%d is greater",b);
}
else{
printf("%d is greater",c);
}
}
Second method:
#include<stdio.h>
void main(){
int a,b,c;
printf("Enter 3 numbers which you want to check: ");
scanf("%d%d%d",&a,&b,&c);
if(a>b){
if(a>c)
printf("a is greater");
else
printf("c is greater");
}
else {
if(b>c)
printf(" b is greater");
else
printf("c is greater");
}
}
0 Comments