Write a C program to calculate the area & perimeter of the rectangle, and the area & circumference of the circle

Rate this post

Problem Statement:

The length & breadth of a rectangle and radius of a circle are input through the keyboard. Write a program to calculate the area & perimeter of the rectangle, and the area & circumference of the circle.

/* Calculation of perimeter and area of rectangle and circle */

#include<stdio.h>
#include<conio.h>

main()
{

int l, b, r, area1, perimeter;
float area2, circum;

clrscr();
printf(“\n Enter Length and Breadth of Rectangle”);
scanf(“%d %d”,&l, &b);

area1=l*b; /*Area of rectangle */
perimeter=2*l+2*b; /* Perimeter of rectangle */

printf(“\n Area of Rectangle = %d”, area1);

printf(“\n Perimeter of Rectangle=%d”,perimeter);

scanf(“%d”,&r);

area2=3.14*r*r; /* Area of Circle */
circum=2*3.14*4; /* Circumference of a circle */\

printf(“Area of Circle=%f”,area2);
printf(“Circumference of Circle-%f”,circum);

printf(“\n\n\n\n Press any key to exit….”);
getch();

}

Related Posts

• 42
Problem Statement: The distance between two cities (in km.) is input through the keyboard. Write a C program to convert and print this distance in meters, feet, inches and centimeters. Answer: /* Conversion of distance */ #include <stdio.h> #include <conio.h> main() { float km, m, cm, ft, inch; clrscr(); /*…
Tags: printf, program, write, calculate
• 41
Here a C program to calculate simple interest using for loop. main ( ) { int p, n, count ; float r, si ; for ( count = 1 ; count <= 3 ; count = count + 1 ) { printf ( "Enter values of p, n, and r…
Tags: printf, program, calculate, write
• 36
Problem Statement: Write a program to calculate the salary as per the following table: Solution: /* C program to calculate salary */ main( ) { char g ; int yos, qual, sal ; printf ( "Enter Gender, Years of Service and Qualifications ( 0 = G, 1 = PG ):" )…
Tags: program, calculate, write
• 34
Write a C Program for the following :- Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary. Answer:  /* To Calculate the gross salary of Ramesh…
Tags: printf, program, write, calculate
• 33
This program is written in C Language using graphics. This will show day, month, date, current time and year as output. #include <graphics.h> #include <time.h> // driver code int main() { // DETECT is a macro defined in // "graphics.h" header file int dt = DETECT, gmode, midx, midy; long current_time;…
Tags: program, rectangle, write

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.