0

I need to calculate the area of a triangle using this formula.
What is wrong with my code?
error C2063: 'p' : not a function

#include <stdio.h>

void Area(int a, int b, int c)
{

int p = a * b * c;
int area = (p(p - a)(p - b)(p - c))/2;
printf("%d",area);

}
int main ()
{
	convert();
	system("pause");

  return 0;
}
2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by alexchen
0

Line 7

int area = (p(p - a)(p - b)(p - c))/2;

should probably be

int area = (p * (p - a) * (p - b) * (p - c))/2;

also line 13 your calling

convert();

You haven't defined a function convert.

Edited by gerard4143: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.