I'm trying to get this program to tell if the numbers in the array are increasing, decreasing or neither. However I can't seem to figure out how to get the program to print neither. Any suggestions?
Code:
#include <stdio.h>
#include <stdbool.h>
int main() {
int i;
int n=0;
bool decreasing = false;
bool increasing = false;
bool neither = false;
int x[3]= {1,2,3};
for(i=x[n]; i<3; i=x[n+=1]){
if(x[n]>x[n+=1]){
decreasing = true;
}
if(x[n]<x[n+=1]){
increasing = true;
}
}
if(increasing){
printf("increasing\n");
}
if (decreasing){
printf("decreasing\n");
}
else{
printf("neither\n");
}
}