+ 1

fix this code

#include<stdio.h> Int main() { int a,b,c; printf("Enter Three Numbers:"); scanf("%d",&a,&b,&c); if (a>=b) { if (a>=c) { printf("a is greater \n"); } else { printf("c is greater \n"); } } else { if (b>=c) { printf("b is greater \n"); } else { printf("c is greater \n"); } } } https://code.sololearn.com/c2mYyTa2TRvD/?ref=app

11th Dec 2021, 4:57 PM
Sahil Kshirsagar
Sahil Kshirsagar - avatar
6 Respostas
+ 1
scanf("%d%d%d",&a,&b,&c); //3 int inputs
11th Dec 2021, 5:09 PM
Jayakrishna 🇮🇳
+ 1
Think you...
11th Dec 2021, 5:17 PM
Sahil Kshirsagar
Sahil Kshirsagar - avatar
+ 1
Think.. Think.. 😇
11th Dec 2021, 5:54 PM
Jayakrishna 🇮🇳
0
#include<stdio.h> int main() { int a,b,c; //clrscr(); printf("Enter Three Numbers:\n"); scanf("%d%d%d",&a,&b,&c); if (a>b) { if (a>c) { printf("%d is greater \n",a); } } else if (b>c) { printf("%d is greater \n",b); } else { printf("%d is greater \n",c); } }
11th Dec 2021, 6:51 PM
Tanmay Bapna
Tanmay Bapna - avatar
0
#include<stdio.h> int main() { int num1,num2,num3; printf("Enter three numbers :"); scanf("%d,%d%d", &num1, &num2, &num3); if((num1>num2) && (num1>num3)) { printf("\nNumber1 is greater"); } else if((num2>num1) && (num2>num3)) { printf("\nNumber2 is greater"); } else printf("\nNumber3 is greater"); return 0; }
12th Dec 2021, 3:26 PM
Varshini M
Varshini M - avatar
0
Use else if statement and also the logical AND operator
13th Dec 2021, 3:00 PM
FREDRICK OCHIENG
FREDRICK OCHIENG - avatar