+ 1
Why d is not printing when it is largest
#include <stdio.h> int main(){ int a, b, c, d; printf("Enter 4 numbers: \n"); scanf("%d %d %d %d", &a, &b, &c, &d); if (a >= b && a >= c) printf("%d is the largest number", a); else if (b>= a && b >= c) printf("%d is the largest number", b); else if (c >= a && c >= b) printf("%d is the largest number", c); printf("%d is the largest number", d); return 0; }
3 Respuestas
0
Include d also in the conditions(comparision) and keep the final printf in else block.
+ 1
Hii ROHAN GUPTA. You have to compare a, b and c with d. Add these conditions -
a>=d
b>=d
c>=d
And your problem will be solved.
https://code.sololearn.com/c6MjQQF0W1s2/?ref=app
0
Thanks "Sarada lakshmi"