0
Triplet of three numbers (a,b,c) Output : 1 if they are either in strictly increasing (a>b>c) or decreasing (a<b<c) order
Can anyone. Help me with this problem?
5 Respostas
+ 1
1)declare a,b,c
2) assign them via input
3) if( ( condition && condition ) || (condition && condition) )
output 1
+ 2
Pratham Yadav ,
it can be also done by sorting both data structures and then doing the comparison:
tup1 = (1,3,2)
tup2 = (2,1,3)
if sorted(tup1) == sorted(tup2):
<do something>
...
0
Triplet of three numbers (a,b,c) Output : 1 if they are either in strictly increasing (a>b>c) or decreasing (a<b<c) order
0
Given three integers a b and c, find if they are strictly increasing/decreasing or not.
0
#include<stdio.h>
int main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c); /*Hai Iam RS*/
if((a<b<c)||(a>b>c))
{
printf("%d",1);
}
else
{
printf("%d",0);
}
return 0;
}