Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Comp1917 - lab2 - Area of a triangle */
- #include <stdio.h>
- #include <math.h>
- int main ( void )
- {
- int a, b, c, s, area;
- printf( "Enter values of sides a, b, and c \n" );
- scanf( "%d %d %d", &a,&b,&c );
- if( a > 0 && b > 0 && c > 0 ); {
- s = (a + b + c) / 2;
- area = sqrt(s * (s - a) * (s - b) * (s - c));
- printf( " Area of triangle is %d \n ", area);
- }
- else {
- printf( "Error, invalid value entered \n " );
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement