How to write a C Program to calculate Area, Perimeter of Rectangle; Area, Circumference of Circle in C Programming Language ?
Solution:
- The program helps you calculate the area and perimeter of a rectangle.
- It also calculates the area and the circumference of the circle.
- The values of Length, Breadth and Radius are to be entered through the keyboard.
The length and breadth of a rectangle and radius of a circle are input through the keyboard. Write a program to calculate the area and perimeter of the rectangle, and the area and the circumference of the circle.
/*
aor: area of rectangle
por: perimeter of rectangle
aoc: area of circle
coc: circumference of circle
*/
aor: area of rectangle
por: perimeter of rectangle
aoc: area of circle
coc: circumference of circle
*/
The circumference of a circle is same as the perimeter that is the distance around the outer edge.
The formula of circumference is = 2 pi r (pi's symbol)
where r = the radius of the circle
and pi = 3.14(Approx)
where r = the radius of the circle
and pi = 3.14(Approx)
- #include <stdio.h>
- //C program to find Area and Circumference of a Circle with Sample Input and Output.
- main()
- {
- float length, breadth, radius, aor, por, aoc, coc;
- printf ("\nEnter the Length and Breadth of the Rectangle: ");
- scanf("%f %f", &length, &breadth);
- printf("\nEnter the Radius of the Circle: ");
- scanf("%f", &radius);
- aor = length*breadth;
- por= 2*(length+breadth);
- aoc = 3.14*radius*radius;
- coc = 2*radius*3.14;
- printf("\nThe area of the rectangle is: %f", aor);
- printf("\nThe perimeter of the rectangle is: %f ", por);
- printf("\n\nThe area of the Circle with radius %f is: %f ", radius, aoc);
- printf("\nThe circumference of the same circle is: %f", coc);
- }
Learn More :
Enter by User
- C Program to Enter an ODD number between 1 and 49.
- C Program to Calculation of One Number Raised to Another
- C Program to Count Vowels, Consonants and Spaces in a string
- C program calculates a given function in range given by user, stores the data in arrays and displays the answer in a table.
- C Program to find result where value and power are user given
- C Program That in a Given Natural Number x Insert Figure c at Position p
- C Program To Find Prime Number And If Number Is Not Prime Then Find Factors
- C program that lets the user choose if he wants to add a item to the shopping list or print it out
- C Program that prompts the user to input a string, (whitespaces allowed)
- C Program to Input Number by the user between 1-100
- How to Gets User Input For Height in C Programming
- Loudness Program: Gets loudness level from user; chooses a response And prints it using logical and operative statements
- C Program Exchange User Entered Text Between 2 Modules
- C Program to accept n numbers from user & find out the maximum element out of them by using dynamic memory allocation
- C Program to accept string from user & convert all lower case letters into upper case letters & vice versa
- C Program to accept m*n matrix from user and display the elements of given matrix using function
- C Program to accept n numbers from user store these numbers into an array & calculate average of n numbers
- C program to accept n number from user,store these numbers into an array & count the no of occurrences of each number
- C Program to accept n numbers from user store these numbers into an array & reverse an array elements using function
- C Program to accept a string from user, delete all vowels from that string & display the result
- Write a c program to accept a string from user & generate following pattern (e.g, input "abcd")
- C Program to accept 5 names from user & store these names into an array. Sort these array elements in alphabetical order
- C Program to accept n numbers from user,store these numbers into an array & sort the number of an array
- C Program to accept n numbers from user, store these numbers into an array. Find out Maximum & Minimum number from an Array
Calculate
- C Programm zur Berechnung von Umfang und Flächeninhalt verschiedener geomatrischer Figuren
- Napisać funkcję obliczającą funkcję geometryczną w tablicy NxM elementowej z elementów o wartościach parzystych znajdujących się pod główną i ponad przeciwną przekątną.
- C Program to Calculate GCD using recursion
- C Program To Calculate First Numbers Using Recursion
- C Program to Calculation of One Number Raised to Another
- C Program to calculate TT and Recharge Amount
- C Program to Calculate 2 numbers with 1 operation
- Un-sortiertes Array and Sortiertes Array
- C Program Calculation of Simple Interest
- C Program to Calculation of Total and Percentage
- C Program for calculation of Gross Salary
- C program calculates a given function in range given by user, stores the data in arrays and displays the answer in a table.
- C Program for statistically calculating pi using a specific scheduling policy.
- C Program that prompts the user to input a string, (whitespaces allowed)
- C Program Number of Judge and Score From Each Judge
- C Program to Calculate the mathematical expression for the first n numbers
- C Program to Calculate the price of movie tickets
- C Program to calculate sum of two m*n matrices & store the result in 3 matrix
- C Program to calculate the sum of elements of upper triangle of a n*n matrix using DMA
- C Program to accept n numbers from user store these numbers into an array & calculate average of n numbers
- Calculate sum of element of upper triangle of m*n matrix by using dynamic memory allocation
- Calculate sum of non-diagonal element in m*n matrix C Program
- Accept n number from user, store these number into an array and calculate the average of n number
- Calculate sum of element of lower triangle of m*n matrix by using dynamic memory allocation
Length
- C Program To Find Length Of A String Including Blank Spaces, Tabs, And Other Special Characters
- C Program To Find Length Of String And Concatenate Two Strings
- C Program To Find The Length, Reverse Of A String And To Check It Is Palindrome or Not
- C Program to find string length without library function
- C Program that prompts the user to input a string, (whitespaces allowed)
- Menu driven program in C to Calculate Length, Copy into Another Compare Concatenate of Two String
Perimeter
Circumference
Rectangle
Breadth
Area