I have this task to find whether 5 integers are ordered from the smallest to the largest or not.
Depending on the results, the program output should be "yes" or "no". No loops or arrays supposed to be used (according to the task). This is my solution, but it's 4 lines longer. Can anyone help me make this better?
int main() {
int a, b, c, d, e;
scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
if ( a < b && b < c ) {
if ( c < d && d < e ) {
printf("yes");
} else {
printf("no");
}
} else {
printf("no");
}
return 0;
}
#include. You could also terminate the strings to be printed with a'\n'for proper line handling :) \$\endgroup\$