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 could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
What are the various types of control structures in programming?
Explain About fork()?
the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
What is c language and why we use it?
Do pointers store the address of value or the actual value of a variable?
what will be maximum number of comparisons when number of elements are given?
What are the different types of pointers used in c language?
Explain about C function prototype?
What is a static function in c?
Explain low-order bytes.
What is meant by initialization and how we initialize a variable?
Compare and contrast compilers from interpreters.
Can math operations be performed on a void pointer?