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

1 comment:

  1. #include
    int main()
    {
    float r;
    printf("\n Enter the radius to calculate the area of circle ");
    scanf("%f",&r);
    printf("\n Area of circle : %f ", 3.14159265358979*r*r);
    printf("\n Perimeter of the circle : %f ", 2*3.14159265358979*r);
    system("pause");
    }

    ReplyDelete

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