/*
* 1000+ C programs + tutorials
*
*
* 6_calculate_area_of_rectangle.c
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include <stdio.h>
//#include <conio.h>
void main() {
int length;
int breadth;
long area;
// clrscr();
printf(" Program to calculate Area of a Rectangle : \n\n");
printf(" Enter the Length of a Rectangle : ");
scanf("%d", &length);
printf("\n\n Enter the Breadth of a Rectangle : ");
scanf("%d", &breadth);
area = length*breadth;
printf("\n\n Area of Rectangle with Length as %d and Breadth as %d = %ld \n\n",length,breadth,area);
// getch();
}
-
Output :
Program to calculate Area of a Rectangle :
Enter the Length of a Rectangle : 20
Enter the Breadth of a Rectangle : 10
Area of Rectangle with Length as 20 and Breadth as 10 = 200
Without using variable
area
/*
* 1000+ C programs + tutorials
*
*
* 6_calculate_area_of_rectangle.c
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include <stdio.h>
//#include <conio.h>
void main() {
int length,breadth;
// clrscr();
printf(" Program to calculate Area of a Rectangle : \n\n");
printf(" Enter the Length of a Rectangle : ");
scanf("%d", &length);
printf("\n\n Enter the Breadth of a Rectangle : ");
scanf("%d", &breadth);
printf("\n\n Area of Rectangle with Length as %d and Breadth as %d = %ld \n\n",length,breadth,length*breadth);
// getch();
}
-
Output :
Program to calculate Area of a Rectangle :
Enter the Length of a Rectangle : 10
Enter the Breadth of a Rectangle : 10
Area of Rectangle with Length as 20 and Breadth as 10 = 100
The best way to learn C programming is to practice more and more of 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.