Showing posts with label Area of Circle and rectangle. Show all posts
Showing posts with label Area of Circle and rectangle. Show all posts

Calculate Area, Perimeter of a Rectangle

Write a Program that accept length,breadth and radius of a rectangle and circle and
display Area,perimeter of a rectangle and circumference of circle

#include <stdio.h>
#include <conio.h>

void main()
{
int a1,p,a2,c,l,b,r;
clrscr();
printf("Enter length,breadth and radius");
scanf("%d%d%d",&l,&b,&r);
a1=l*b;
p=2*(l+b);             
a2=3.14*r*r;
c=2*3.14*r;
printf("\nArea and Perimeter of a rectangle is %d and %d",a1,p);
printf("\nArea and circumference of a circle is %d and %d",a2,c);
getch();
}

Related Post

Array:
String functions:
General (Loops-for/while)
Write a Program to print reverse of a given number Write a Program to print Product of Digits (eg. 212=2*1*2=4) of a given number Write a C++ Program to Convert Binary into Decimal Number