write a c programe to enter 3 numbers and find maximum number using loop. remember u can use only one if condition
Answers
Answered by
0
You can do it in 3 ways namely
For Beginners
int main(void)
{
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if((a>b)&&(a>c))
printf("a is largest of three");
if((b>c)&&(b>a))
printf("b is largest of three");
else
printf("c is largest");
return 0;
}
for experts :-
int main(void)
{
int a,b,c,largest;
scanf("%d%d%d",&a,&b,&c);
largest=(a>b)?(a>c?a:c):(b>c?b:c);
printf("%d",largest);
return 0;
}
See your level get the concept.
Similar questions