what is the problem here?

Write your question here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  #include<stdio.h>
#include<math.h>

int main(){
int x,y,z;
float a,h;

printf("Enter three sides of s triangle");

scanf("%d","%d", "%d",&x,&y,&z);
h= sqrt((y+z/2)*(y-z/2));
a= ((.5*h)*(z/2));
printf("the area is : %f",a);

return 0;
}


the output shows error


Compiling TRIANGLE.C:
Error TRIANGLE.C 11: Undefined symbol 'a' in function main()
Error TRIANGLE.C 11: Compound statement missing } in function main()
Warning TRIANGLE.C 11: Function should return a value in function main()
Warning TRIANGLE.C 11: 'h' is assigned a value that is never used in function main()
I dont know it works fine for me but on line 10 it should be "%d%d%d" not "%d","%d","%d":

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  #include<stdio.h>
#include<math.h>

int main(){
int x,y,z;
float a,h;

printf("Enter three sides of s triangle");

scanf("%d%d%d",&x,&y,&z);
h= sqrt((y+z/2)*(y-z/2));
a= ((.5*h)*(z/2));
printf("the area is : %f",a);

return 0;
}
i gave it first but it shows error and i wrote like this "%d"%d"%d"
however i corrected as you told but it shows error still :(
put the commas back in.
scanf("%d,%d,%d",&x,&y,&z)

when you enter the numbers, separate them with commas, 4,5,6
it worked on OrWel DEV C++ but error on Turbo C++..

BUt After working the DEV crushed maybe.. it shows "
 failed to execute..
it shows on and off . I don't understand
Topic archived. No new replies allowed.