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 does the c preprocessor do?
Can you think of a logic behind the game minesweeper.
Write a program to reverse a given number in c?
Explain how can I open a file so that other programs can update it at the same time?
what do you mean by inline function in C?
What is the use of pointers in C?
Is c pass by value or reference?
Do variables need to be initialized?
Describe the difference between = and == symbols in c programming?
What standard functions are available to manipulate strings?
What is call by reference in functions?
Explain what is the benefit of using const for declaring constants?
How does selection sort work in c?
What are the types of assignment statements?
What is the hardest programming language?