+ 1
I need output as 1 if a, b, c are either in increasing or decreasing order. Else output should be 0
I get error. Pls help https://code.sololearn.com/cuXi2x8zzdj0/?ref=app
3 odpowiedzi
+ 5
You are mixing python syntax with C.
a>b>c works like (a>b) > c so you are comparing c with either 0 or 1. It does not mean, "in between " in C.
It should like a > b && b > c
So finally, modify to :
if( ( a > b && b > c ) || (a < b && b < c) ){
edit: also put semicolon after each statement terminal.
+ 2
#include <stdio.h>
int main() {
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if(a>b>c || a<b<c) {
printf("1");
}
else {
printf("0");
}
return 0;
}
please see your code mistake and then copy it.
+ 1
Are you idian to much