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
The difference between printf and fprintf is ?
Tell me what is null pointer in c?
What are the 4 types of functions?
What are the complete rules for header file searching?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
Explain what are the advantages and disadvantages of a heap?
Can math operations be performed on a void pointer?
What is the heap in c?
Are global variables static in c?
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)
Write a program to check whether a number is prime or not using c?
What is a nested loop?
What is #pragma statements?
What is the difference between a free-standing and a hosted environment?
What is use of null pointer in c?