-
Notifications
You must be signed in to change notification settings - Fork 7
/
11.c
47 lines (47 loc) · 978 Bytes
/
11.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//Program to accept three numbers from user and print them in ascending and descending order
#include<stdio.h>
int main()
{
int a,b,c;
printf("Enter three numbers\t");
scanf("%d\n%d\n%d",&a,&b,&c);
if(a>=b && a>=c)
{
if(b>=c)
{
printf("Descending order\t%d\t%d\t%d",a,b,c);
printf("\nAscending order\t%d\t%d\t%d",c,b,a);
}
else
{
printf("Descending order \t%d\t%d\t%d",a,c,b);
printf("\nAscending order\t%d\t%d\t%d",b,c,a);
}
}
else if(b>=a && b>=c)
{
if(a>=c)
{
printf("Descending order\t%d\t%d\t%d",b,a,c);
printf("\nAscending order\t%d\t%d\t%d",c,a,b);
}
else
{
printf("Descending order\t%d\t%d\t%d",b,c,a);
printf("\nAscending order\t%d\t%d\t%d",a,c,b);
}
}
else
{
if(b>=a)
{
printf("Descending order\t%d\t%d\t%d",c,b,a);
printf("Ascending order\t%d\t%d\t%d",a,b,c);
}
else
{
printf("Descending order\t%d\t%d\t%d",c,a,b);
printf("Ascending order\t%d\t%d\t%d",b,a,c);
}
}
}