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







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







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();
}


Output



Comments

Popular posts from this blog

Code for pattern 6

Code to check leap year