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


Please Help Members By Posting Answers For Below Questions

What is function in c with example?

636


What is variable declaration and definition in c?

505


Explain what are header files and explain what are its uses in c programming?

632


How can I split up a string into whitespace-separated fields?

573


What is the difference between c &c++?

649






.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }

713


Does free set pointer to null?

569


Explain c preprocessor?

687


Is c easy to learn?

563


Where is volatile variable stored?

655


What does & mean in scanf?

606


how can use subset in c program and give more example

1507


swap 2 numbers without using third variable?

666


What is the -> in c?

591


What are bitwise shift operators in c programming?

650