In this program, # is a preprocessor directive , whereas #include<filename.h> is
used to extract the functions already created in file .float a creates a float type variable
which stores side of square given by user . area of square = side*side &
perimeter of square = 4*side which are stored in ar & peri respectively .
used to extract the functions already created in file .float a creates a float type variable
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Program for Square Area and Parameter.
#include<stdio.h>#include<conio.h>
void main()
{ float ar,peri,a;
clrscr();
printf("\n program to calculate area & perimeter of square");
printf("\n\n enter side of square : ");
scanf("%f",&a);
ar = a*a;
peri = 4*a;
printf("\n area of circle = %f",ar);
printf("\n perimeter of square = %f",peri);
getch();
}

No comments:
Post a Comment
Guys if you think something is wrong or should be edit than please do comment.