C
program for area of a rectangle
Formula of area of rectangle:
Area = length * width
C code:
#include<stdio.h>
int main(){
float l,w;
float area;
printf("Enter
size of each sides of the rectangle : ");
scanf("%f%f",&l,&w);
area
= l * w;
printf("Area of
rectangle is: %.3f",area);
return 0;
}
Sample
output:
Enter size of each sides of the rectangle: 5.2 20
Area of rectangle is: 104.000
7. Write a c program to find the area of rhombus.
8. Write a c program to find the area of parallelogram.
2 comments:
Much helpful for beginners .
#include
#include
int main() {
int length, breadth, area;
printf("\nEnter the Length of Rectangle : ");
scanf("%d", &length);
printf("\nEnter the Breadth of Rectangle : ");
scanf("%d", &breadth);
area = length * breadth;
printf("\nArea of Rectangle : %d", area);
return (0);
}
Post a Comment