C Programe to find Area ( Circle, Rectangle, Trangle, Square)



C language first chapter click here

1. Area of Circle

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
float r,area;
printf("enter radius:");
scanf("%d",&r);
area=3.14*r*r;
printf("area of circle=%d",area);
getch();
}

Output:                    
enter radius:5          
area of circle=78.5  


2.Area of Rectangle



#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int l,b,area;
printf("enter lenght & breath:");
scanf("%d%d",&l,&b);
area=l*b;
printf("area of ractangle=%d",area);
getch();
}

Output:                                  
enter lenght & breath:4 
5                                            
area of rectangle=20             


3. Area of trangle

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int h,b,area;
printf("Enter hight and base:");
scanf("%d%d",&l,&b);
area=0.5*h*b;
printf("Area of trangle=%d",area);
getch();
}

Output:                         
Entrer hight and base:3
4                                   
Area of trangle=6        

4.Area of Square

#include<stdio.h>
#include<conio.h>
void main()
{
int area,s;
clrscr();
printf("enter one side:");
scanf("%d%d",&s);
area=s*s;
printf("Area of square=%d",area);
getch();
}

Output:                  
enter one side:5     
Area of square=25 



Share this

Related Posts

Previous
Next Post »