Explain the structure of a C programme with suitable example
Answers
Answered by
0
Answer:
#include <stdio.h>
struct Rectangle{
int len;
int breadth;
};
int main()
{
struct Rectangle r;
printf("Enter the length of the rectangle:");
scanf("%d" , &r.len);
printf("Enter the breadth of the rectangle:");
scanf("%d" , &r.breadth);
int area = r.len*r.breadth;
int perimeter = 2*(r.len+r.breadth);
printf("The area of the rectangle is %d and the perimeter of the rectangle is %d \n" , area , perimeter);
return 0;
}
Explanation:
Similar questions