Write a c program to sort six numbers and find the largest
one by using the ladder of if-else?
plz do help me
Answers were Sorted based on User's Feedback
Answer / sandeep kumar yadav. by m.c.a
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d,e,f,max;
clrscr();
printf("Enter the six Number \n");
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>a && b>c && b>d && b>e && b>f)
max=b;
else if(c>a && c>b && c>d && c>e && c>f)
max=c;
else if(d>a && d>b && d>c && d>e && d>f)
max=d;
else if(e>a && e>b && e>c && e>d && e>f)
max=e;
else if(f>a && f>b && f>c && f>d && f>e)
max=f;
printf("\n\n Maximum Number is = %d",max);
getch();
}
| Is This Answer Correct ? | 35 Yes | 9 No |
Answer / 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 |
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
what is the syallabus of computer science students in group- 1?
a value that does not change during program execution a) variabe b) argument c) parameter d) none
What are the 5 data types?
main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } what is the output?
What is file in c preprocessor?
In the following control structure which is faster? 1.Switch 2.If-else and which consumes more memory?
What are the types of functions in c?
what is difference between array,strutter,union and pointers
3 Answers CTS, Lovely Professional University, Mannar Company,
Why do we use c for the speed of light?
write a statement to display all the elements array M(in reverse order? int M[8]={20,21,22,23,24,25,26,27};
How to avoid buffer overflow?