Search Your C Program

Tuesday, 24 January 2012

Program to Calculate Area and Perimeter of a Rectangle

#include<stdio.h>
#include<conio.h>
void  main()
{
                     float l,b,ar,pr;
                     printf("\n Enter length and breadth of rectangle");
                     scanf("%f %f",&l,&b); //Multiple inputs separated by space
                     ar=l*b;
                     pr=2*(l+b);
                     printf("\n Area of Rectangle = %f ",ar);
                     printf("\n Perimeter of Rectangle = %f",pr);
                     getch();
}

No comments:

Post a Comment