You are on page 1of 2

Working Example

Program to find the area of a triangle



/* Program to find the area of a triangle */
#include<stdio.hh>
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c,s,area;
printf("Enter the values for sides of the triangle:");
scanf("%f%f%f",&a,&b,&c);
s=(a+b+c)/2;
area=sqrt((s)*(s-a)*(s-b)*(s-c));
printf("Area > %f\n",area);
getch();
}
/*
output
Enter the values for sides of the triangle:
3 4 5
Area > 6.000000
*/

Working Example
Program to find the area of a circle

/* Program to find the area of a circle */
#define PIE 3.14
#include<stdio.h>
#include<conio.h>
void main()
{
float radius,area;
printf("Enter the radius of the circle:");
scanf("%f",&radius);
area=PIE*radius*radius;
printf("Area of the circle is %f",area);
getch();
}
/*
output
Enter the radius of the circle:5
Area of the circle is 78.500000
*/

You might also like