I need to input a number (user enters -1
to exit) and the program needs to tell if it increasing monotone sequence.
I did it in do-while
loop, I know that if I want to check if it is increasing I need to check the previous number and then compare the previous
and the current
number.
But still, its hard to me to imagine the process of the loop.
Here is the code:
#include <stdio.h>
void main()
{
int num, i = 0, numPrev = 0;
printf("Enter a number:");
do {
scanf("%d", &num);
numPrev = num;
i++;
if (num > numPrev)
} while (num != -1);
printf("The Serias is Monotinic Acsending\n");
}