Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
Triplet of three numbers (a,b,c) 1, if a>b>c 0, otherwise
–2
votes
asked
Aug 9, 2019
by
anonymous
Input : Triplet of three numbers (a,b,c)
Output : 1 if a>b>c
0, otherwise
Please
log in
or register to answer this question.
2 Answers
+1
vote
answered
Aug 12, 2019
by
anonymous
edited
Aug 15, 2019
#include<stdio.h>
int main(){
int a,b,c;
printf("Enter 3 numbers:\n");
scanf("%d %d %d",&a, &b, &c);
if(a>b && b>c){
printf("1");
}
else{
printf("0");
}
return 0;
}
commented
Aug 13, 2019
by
codenstory
(
100
points)
This answer is causing compile error.
because comparison operator can compare two numbers only.
like this:
a < b < c (x)
a < b && b < c (o)
Please
log in
or register to add a comment.
–2
votes
answered
Aug 13, 2019
by
codenstory
(
100
points)
#include <cstdio>
int main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
printf("%d", (a < b && b < c) ? 1 : 0);
return 0;
}
commented
Aug 14, 2019
by
anonymous
its stdio.h for header file
and its a>b&&b>c
commented
Aug 16, 2019
by
codenstory
I'm sorry.
but in C++, cstdio should be used instead of stdio.h.
Please
log in
or register to add a comment.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...