C Programming

Solved Example

Practice Questions

Exercise Question

Calculate area of rectangle


Input the width and height of the rectangle and calculate the area of the rectangle.

Program / Solution

int main() {
	int width,height,area;
	printf("Enter width and height of rectangle: ");
	scanf("%d %d",&width,&height);
	area = width * height;
	printf("Area of rectangle = %d",area);
	return 0;

Sample output:

Enter width and height of rectangle: 20 100
Area of rectangle = 2000