//C Program To Find Area of Rectangle
#include<stdio.h>
void main()
{
float l,b,area;
printf("Enter length of rectangle: ");
scanf("%f",&l);
printf("Enter breadth of rectangle: ");
scanf("%f",&b);
area=(l*b);
printf("Area of Rectangle : %f\n",area);
}
Output
Enter length of rectangle: 10
Enter breadth of rectangle: 12
Area of Rectangle : 120.000000
C Program To Find Area of Rectangle Using Function
Algorithm
Program Start
Declare Variables
Input length and breadth From User
Calling Function To Calculate Area of Rectangle
Calculating Area of rectengle
Display Result
Program End
Program
//C Program To Find Area of Rectangle Using Function
#include<stdio.h>
void aor(float l, float b);
void main()
{
float l,b;
printf("Enter length of rectangle: ");
scanf("%f",&l);
printf("Enter breadth of rectangle: ");
scanf("%f",&b);
aor(l,b);
}
void aor(float l, float b)
{
float area;
area = (l*b);
printf("Area of Rectangle : %f\n",area);
}
Output
Enter length of rectangle: 3
Enter breadth of rectangle: 5
Area of Rectangle : 15.000000
C Program To Find Area of Rectangle Using Pointer
Program
//C Program To Find Area of Rectangle Using Pointer
#include<stdio.h>
void aor(float *l, float *b);
void main()
{
float l,b;
printf("Enter length of rectangle: ");
scanf("%f",&l);
printf("Enter breadth of rectangle: ");
scanf("%f",&b);
aor(&l,&b);
}
void aor(float *l, float *b)
{
float area;
//here l and b is a pointer variable
area = (*l)*(*b);
printf("Area of Rectangle : %f\n",area);
}
Output
Enter length of rectangle: 30
Enter breadth of rectangle: 15
Area of Rectangle : 45.000000
C Program To Find Area of Rectangle Using Micro or #Define
Program
//C Program To Find Area of Rectangle Using #define
#include<stdio.h>
#define area(l,b) (l*b)
void main()
{
float l,b,area;
printf("Enter length of rectangle: ");
scanf("%f",&l);
printf("Enter breadth of rectangle: ");
scanf("%f",&b);
printf("Area of Rectangle : %f\n",area(l,b));
}
Output
Enter length of rectangle: 30
Enter breadth of rectangle: 50
Area of Rectangle : 150.000000
C Program To Find Area of Rectangle (Simple Way)
Algorithm
Program
Output
C Program To Find Area of Rectangle Using Function
Algorithm
Program
Output
C Program To Find Area of Rectangle Using Pointer
Program
Output
C Program To Find Area of Rectangle Using Micro or #Define
Program
Output
need an explanation for this answer? contact us directly to get an explanation for this answer