0
I need to calculate the area of a rectangle triangle but I cannot identify the error.
#include<stdio.h>
#include<math.h>
int main()
{
//declaracao de variaveis
int a, b, c;
int s;
int s1, s2, s3;
int total;
int area;
int sa, sb, sc;
//inicio
printf("digite 'a': ");
scanf("%d", &a);
printf("digite 'b': ");
scanf("%d", &b);
printf("digite 'c': ");
scanf("%d", &c);
s = (a + b + c) / (2);
area = (s * (s - a) * s *(s - b) * s * (s - c);
printf("\nAREA: %.2d", area);
return(0);
In the variable
area
, you opened a parenthesis and did not close before theprintf
of the result.– Daniel Mendes
The variable
s
, as well asarea
, shouldn’t befloat
?– anonimo
My mistake, the variable should be float!
– João Rosa
But it would be necessary to add the sqrt() command to the area variable and I don’t know how to do it ;(
– João Rosa