+ 1
what is the problem of this code
pls solve the problem #include<stdio.h> int main() { int a,b,c; scanf("%d%d%d",&a,&b,&c); if(a<b) { if(a<c) { printf("%d", a); } else { printf("%d", c); } } else { if(b<c) { printf("%d", b); } else { printf("%d", c); } } }
3 Answers
+ 1
Seems to be working fine though
The output is the minimum value right? For example:
INPUT:
4 1 7
OUTPUT:
1
https://code.sololearn.com/crl0mS3e5Wsu/?ref=app
+ 2
#include<stdio.h>
int main()
{
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if(a<b && a<c)
{
printf("%d", a);
}
else if (b<a && b<c)
{
printf("%d", c);
}
else
{
printf("%d", c);
}
return 0;
}
+ 2
You should use if-else-if condition in such type of code ...
Hope it will be helpful to you