Find Area To Be Painted In C

Write a C program to find the area of room to be painted.

C Program:

/* Aim: To Find Area To Be Painted  */ 

#include<stdio.h>

void main()
{
	float l,b,h,c,d,e,f,area,Aroof,door,window;
 
	printf("\n \n Enter length of a room:" );
	scanf("%f",&l);
 
	printf("\n \n Enter breadth of a room:" );
	scanf("%f",&b);

	printf("\n \n Enter height of a room:" );
	scanf("%f",&h);

	printf("\n \n Enter height of a door:" );
	scanf("%f",&c);

	printf("\n \n Enter width of a door:" );
	scanf("%f",&d);

	printf("\n \n Enter length of a window:" );
	scanf("%f",&e);

	printf("\n \n Enter breadth of a window:" );
	scanf("%f",&f);

	door=c*d;
	window=e*f;
	area=((2*(l*h)+2*(b*h))-door-(2*window));
	Aroof=l*b;

	printf("\n \n The area of interior walls to be painted is %f sq.m",area);
	printf("\n \n The are of roof to be whitewashed is %f sq.m\n \n ",Aroof);

}

Output:

 Enter length of a room:12

 
 Enter breadth of a room:24

 
 Enter height of a room:28

 
 Enter height of a door:12

 
 Enter width of a door:16

 
 Enter length of a window:5

 
 Enter breadth of a window:5

 
 The area of interior walls to be painted is 1774.000000 sq.m
 
 The are of roof to be whitewashed is 288.000000 sq.m

Comments