Search



Monday, 16 February 2015

Area and Para of Rectangle

In this program, # is a preprocessor directive ,  whereas #include<filename.h> is used
to extract the functions already created in file .float a,b creates float type variables
which stores length & breadth of square given by user area of rectangle = length*breadth
perimeter of rectangle = 2*(length+breadth) which are stored in ar & peri respectively .  

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Program for Rectangle Area and Parameter.

#include<stdio.h>
#include<conio.h>
void main()
{ float ar,peri,a,b;
clrscr();
printf("\n program to calculate area & perimeter of rectangle");
printf("\n\n enter side1 of rectangle : ");
scanf("%f",&a);
printf("enter side2 of rectangle : ");
scanf("%f",&b);
ar = a*b;
peri = 2*(a+b);
printf("\n area of circle = %f",ar);
printf("\n perimeter of rectangle = %f",peri);
getch();
}



No comments:

Post a Comment

Guys if you think something is wrong or should be edit than please do comment.