To calculate area of Parallelogram, you need to know the height and breadth of a Parallelogram. You can ask user to enter height and breadth and calculate the area.
Variables:1. height: (Datatype int): to represent the height of the Parallelogram.
2. breadth: (Datatype int): to represent the breadth of Parallelogram.
3. area: (Datatype long): to store the result of the area of the Parallelogram being computed.
Functions:printf(): is used to display something on the console/screen. Format specifier %d in printf function is used to display an int variable on-screen and %ld for long. \n is used to add a new line
scanf(): is used to fetch data inputted by the user on the console/screen using the keyboard. %d in scanf is indicated that inputted text is of type int and %ld for long
Formula:Area of Parallelogram: height x breadth
/*
* 1000+ C programs + tutorials
*
*
* 7_calculate_area_of_parallelogram.c
*
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include <stdio.h>
//#include <conio.h>
void main() {
int height;
int breadth;
long area;
// clrscr();
printf(" Program to calculate Area of a Parallelogram : \n\n");
printf(" Enter the Length of a Parallelogram : ");
scanf("%d", &height);
printf("\n\n Enter the Breadth of a Parallelogram : ");
scanf("%d", &breadth);
area = height*breadth;
printf("\n\n Area of Parallelogram with Height as %d and Breadth as %d = %ld \n\n",height,breadth,area);
// getch();
}
Output:
Program to calculate Area and Circumference of Circle :
Enter the radius of Circle : 5
Area of circle with radius 5 = 78.550003
Circumference of circle with radius 5 = 31.420000
The best way to learn C programming is to practice more and more programs. Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.
BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.
- Calculate Volume of Sphere
- Find Sum of two numbers
- Calculate Area of Parallelogram
- Calculate Area and Circumference of Circle
- Calculate Area of Square
- Calculate Volume of Pyramid
- Division between two numbers
- Calculate Volume of Cylinder
- Calculate Volume of Cube
- Calculate Volume of Ellipsoid
- Find Difference of two numbers
- Calculate Area of Trapezoid
- Calculate Area of ellipse
- Calculate Volume of Cone
- Calculate Area of a Rectangle
- Bash Command to Do Nothing with Example - Bash
- Graph API error when querying BookingBusinesses - ErrorExceededFindCountLimit, The GetBookingMailboxes request returned too many results - Microsoft
- [Vi/Vim] How to move cursor to the start of a line - MacOS
- JavaScript : Get url protocol HTTP, HTTPS, FILE or FTP - JavaScript
- Android: Unknown error code during application install : - Android
- Mac (macos) startup keyboard boot sequence combinations - MacOS
- Fix SharePoint 2019 installation error This product requires Visual C++ Redistributable Package for Visual Studio 2017 - SharePoint
- Increase Font Size of Eclipse Java Code - Eclipse