+ 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
6 Respostas
+ 1
scanf("%d%d%d",&a,&b,&c); //3 int inputs
+ 1
Think you...
+ 1
Think.. Think.. 😇
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);
}
}
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;
}
0
Use else if statement and also the logical AND operator