Simple Programs
Code for area of rectangle
#include<stdio.h>
#include<conio.h>
void main()
{
int a,l,b;
printf("Enter length and breadth");
scanf("%d%d",&l,&b);
a=l*b;
printf("Area=%d",a);
getch();
}
Output
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOObTr77VXSeHTyqBijO7QMG8p4ou344B95wqatUxQGmYc2AeKoXPY8PpX-X1BekJ4s9P_k9flKvHZoNHAQGfAq3Os7v2wCrHMcGGkYmmZ6uc3yXagV14FXroj0VqsqDQTZP4CD_pGgkg/s320/2017-06-22.png)
Code for area of square
#include<stdio.h>
#include<conio.h>
void main()
{
int a,s;
printf("Enter side of square");
scanf("%d",&s);
a=s*s;
printf("Area=%d",a);
getch();
}
Output
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvWsV69UmlYs98UlTsxo4M-jVVFWStQ_WHomLb6CppSQGB_pJ4YIrL3F-ruPNIl-NQvcZ50qBDC8HcFUxFk4HQsPvYxhwb02aaiGXtzEQtf9JIAGC7REc1AgtUnQcM8_Rrg3silJtg3AI/s320/2017-06-22+%25281%2529.png)
Code for area of circle
#include<stdio.h>
#include<conio.h>
void main()
{
int r;
float a;
printf("Enter radius of circle");
scanf("%d",&r);
a=3.15*r*r;
printf("Area=%f",a);
getch();
}
Comments
Post a Comment