tbonus.c
542 Bytes
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
#include <stdio.h>
int main () {
int i;
int numberArray[10];
printf("Enter the 10 numbers that need to be checked:\n");
for (i=0; i<10; i++){
scanf("%d", &numberArray[i]);
}
int isasc=1;
for(i=1; i<10; i++){
if(numberArray[i]<numberArray[i-1]){
isasc=0;
}
}
if(isasc==1){
printf("ascending");
return 0;
}
int isdesc=1;
for(i=1; i<10; i++){
if(numberArray[i]>numberArray[i-1]){
isdesc=0;
}
}
if(isdesc==1){
printf("descending");
return 0;
}else printf("neither");
return 0;
}