// C08_Ex 6: Input 4 whole number
// To arrange this numbers in order of in ascending
#include <stdio.h>
void main()
{
int a, b, c, d, tempt;
printf("Input a, b, c, d: ");
scanf("%d%d%d%d", &a, &b, &c, &d);
if (a > b) { tempt = a; a = b; b = tempt; }
if (a > c) { tempt = a; a = c; c = tempt; }
if (a > d) { tempt = a; a = d; d = tempt; }
if (b > c) { tempt = b; b = c; c = tempt; }
if (b > d) { tempt = b; b = d; d = tempt; }
if (c > d) { tempt = c; c = d; d = tempt; }
printf("=> After arranging in ascending: %d %d %d %d\n", a, b, c, d);
}
Arranging numbers in ascending order |
0 Comments:
Post a Comment