C Program
to find out the area of a rectangle
This is a C program to find out area of a rectangle. It will
be useful to the beginners of C programming. In this example, it takes the length and breadth of the rectangle as input to the program, calculates the area using the formula length * breadth and prints the result.
See the
source code of the program
/*
Program to find
out the area of a rectangle
inputs : length and breadth
output : area
*/
# include <stdio.h>
void main () {
float
length,breadth, area;
clrscr();
printf
("Input\n-----\n\n");
printf
("Enter length of the rectangle:");
scanf
("%f", &length);
printf
("Enter breadth of the rectangle:");
scanf
("%f", &breadth);
area = length *
breadth;
printf
("\n\nOutput\n------\n\n");
printf("Area
of the rectangle is:%.2f", area);
printf("\n\nPress
any key to continue...");
getch();
}
Output
No comments:
Post a Comment