In: Computer Science
write a C program to display the dimensions of a room along with number of doors and number of windows. make it user prompt including a function.
#include<stdio.h>
void getDetails() //function for user prompting
{
float length,width; //length and width variables are of type
float
int no_of_doors,no_of_windows; //windows and doors are of type
integer
printf("Enter length of room: ");
scanf("%f",&length); //length input
printf("Enter width of room: ");
scanf("%f",&width); //width input
printf("Enter no of doors: ");
scanf("%d",&no_of_doors); //doors input
printf("Enter no of windows: ");
scanf("%d",&no_of_windows); //windows input
printf("length of room is: %.2f\n",length); //printing length
printf("length of room is: %.2f\n",width); //printing width
printf("no of doors in room is: %d\n",no_of_doors); //printing
doors count
printf("no of windows in room is: %d\n",no_of_windows); //printing
windows count
}
int main() //main function
{
getDetails(); //function calling
return 0;
}