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 are the keywords in c?
Is it possible to have a function as a parameter in another function?
What is the use of typedef in structure in c?
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
Is there any data type in c with variable size?
Explain Function Pointer?
Can the “if” function be used in comparing strings?
What are the advantages of union?
Explain the advantages and disadvantages of macros.
What is difference between array and structure in c?
What is the difference between c and python?
What is modeling?
What does *p++ do? What does it point to?
Can you assign a different address to an array tag?
What is nested structure in c?