0

Can someone pin point the error?

Heres my code: #include <stdio.h> main (void) { int num1; int num2; int num3; printf("Enter the first integer: "); scanf("%d", &num1); printf("Enter the second integer: "); scanf("\n%d", &num2); printf("Enter the third integer: "); scanf("\n%d", &num3); if(num1>num2>num3); printf("%d %d %d", num1, num2, num3); return 0; } TEST CASE 1 Result: Enter the first integer: 3 Enter the second integer: 2 Enter the third integer: 1 3 2 1 Expected result: Enter the first integer: 3 Enter the second integer: 2 Enter the third integer: 1 3 2 1 Yes TEST CASE 2 RESULT: Enter the first integer: 1 Enter the second integer: 2 Enter the third integer: 3 1 2 3 THE RESULT OF TEST 2 IS CORRECT BUT IN TEST 1 IS WRONG🤔 whats the error for the test number 1?

10th Nov 2021, 5:57 AM
Im new
5 Respostas
+ 1
There is Yes in expected result. But you didn't print Yes in the if block.
10th Nov 2021, 7:19 AM
Kashyap Kumar
Kashyap Kumar - avatar
+ 1
if(num1>..............){ printf(........); printf("\nYes"); return 0; }
10th Nov 2021, 7:30 AM
Kashyap Kumar
Kashyap Kumar - avatar
0
Uhmm where i can put it?
10th Nov 2021, 7:24 AM
Im new
0
Yah i put it but the test case 2 is now wrong
10th Nov 2021, 7:33 AM
Im new
0
If you're supposed to print the values even if num1 isn't > to num2 and num2 isn't superior to num3, you should just put a if after the printf(nums). It would be if(num1 > num2 > num3) printf("Yes");
10th Nov 2021, 6:03 PM
Mélodie Bernard
Mélodie Bernard - avatar