I need output as 1 if a, b, c are either in increasing or decreasing order. Else output should be 0 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

28th Jan 2023, 3:20 PM
Aishwarya Manoharan
Aishwarya Manoharan - avatar
3 Answers
+ 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.
28th Jan 2023, 3:37 PM
Jayakrishna 🇮🇳
+ 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.
28th Jan 2023, 3:29 PM
Sakshi
Sakshi - avatar
+ 1
Are you idian to much
29th Jan 2023, 7:11 AM
Atiq Ahmad
Atiq Ahmad - avatar