Write a c program to sort six numbers and find the largest
one by using the ladder of if-else?
plz do help me
Answer Posted / jugal k. sewag
#include<stdio.h>
#include<conio.h>
void main(){
int a,b,c,d,e,f;
int max;
clrscr();
printf("Enter any six numbers: ");
scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
if(a>=b && a>=c && a>=d && a>=e && a>=f)
max =a;
else if(b>=c && b>=d && b>=e && b>=f)
max=b;
else if(c>=d && c>=e && c>=f)
max=c;
else if(d>=e && d>=f)
max=d;
else if(e>=f)
max=e;
else
max=f;
printf("Max among six number is: %d",max);
getch();
}
Is This Answer Correct ? | 14 Yes | 12 No |
Post New Answer View All Answers
What is function in c with example?
What is variable declaration and definition in c?
Explain what are header files and explain what are its uses in c programming?
How can I split up a string into whitespace-separated fields?
What is the difference between c &c++?
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
Does free set pointer to null?
Explain c preprocessor?
Is c easy to learn?
Where is volatile variable stored?
What does & mean in scanf?
how can use subset in c program and give more example
swap 2 numbers without using third variable?
What is the -> in c?
What are bitwise shift operators in c programming?