0
Is anything wrong here
#include<stdio.h> #include<math.h> void main() { int t,h; float c; printf("enter c,t,h"); scanf("%d %d %f",&c,&t,&h); if(((h>50)&&(c>.7)&&(t<5600))||((h<50)&&(c<.7)&&(t<5600))||((h<50)&&(c>.7)&&(t>5600))) printf("grade6"); else printf("poor steel"); #include<stdio.h> #include<math.h> void main() { int t,h; float c; printf("enter c,t,h"); scanf("%d %d %f",&c,&t,&h); if(((h>50)&&(c>.7)&&(t<5600))||((h<50)&&(c<.7)&&(t<5600))||((h<50)&&(c>.7)&&(t>5600))) printf("grade6"); else printf("poor steel"); } }
8 Respuestas
+ 4
Hi Iulian Gudumac
Dipu Ojha knows this already as in the previous post
please read posts before commenting
+ 3
Yes, the code is repeated
and sorry i dont fully understand C
+ 1
You inserted code twice and made error in scanf. Here is the corrected version.
#include<stdio.h>
#include<math.h>
void main()
{
int t,h;
float c;
printf("enter c,t,h");
/* Error was here
scanf("%d %d %f",&c,&t,&h);
*/
scanf("%f %d %d",&c,&t,&h);
if(((h>50)&&(c>0.7)&&(t<5600))||((h<50)&&(c<0.7)&&(t<5600))||((h<50)&&(c>0.7)&&(t>5600)))
printf("grade6");
else
printf("poor steel");
}
+ 1
There was also an error in scanf()
The first variable read is of float type so use %f for var c.
The remaining two variables are of int type, so use %d for vars t, h.
+ 1
I don't C ;)
+ 1
Pay attention to the variable types inside the scanf. You tried to read a float variable c using %d. Should be used %f for float varible c. For the int variables t,h should be used %d%d.
as result,
%d %d %f
will read
int int float
I hope this helps.
+ 1
thanks
0
oo only that nothing in the coding stuff