About Lesson
Given three integers a b and c, find if they are strictly increasing/decreasing or not.
Input
——-
Triplet of three integers (a,b,c)
Output
———
You have to output 1 if they are either in strictly increasing (a>b>c) or decreasing (a<b<c) order.
Output 0, otherwise.Sample Test Cases
Input | Output | |
Test Case 1 | 1 4 6 | 1 |
Test Case 2 | 1 1 0 | 0 |
Test Case 3 | 1 -1 -4 | 1 |
Test Case 4 | 6 4 4 | 0 |
Test Case 5 | 55 55 55 | 0 |
Test Case 6 | 4 3 2 | 1 |
Test Case 7 | 1 2 1 | 0 |
Answer:
#include <stdio.h>
int main(){
int a,b,c;
scanf("%d %d %d", &a, &b, &c);
if(((a>b) && (b>c))||((c>b) && (b>a))){
printf("1");
}
else{
printf("0");
}
return 0;
}