Jump to content
Science Forums

saaaketh

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by saaaketh

  1. first problem in your program is that you provided a semicolon in the if and if else statements. secondly say 3, 2 ,1 be the numbers you are entering then your program will first check 3<2? this will result in 0 and then try to check 0<1 this is true so it will print the value 3. like it prints the other values on other if else statements. also use float for storing average. avg=(x+y+x)/3.0; where avg is in float. if you want to check which is smaller follow this. void main() { int x,y,z; scanf("%d%d%d",&x,&y,&z); if(x<y && x<z) { printf("%d",x); } else if(y<x && y<z) { printf("%d",y); } else if(z<y && z<x) { printf("%d",z); } }
×
×
  • Create New...