#include <stdio.h>
void function1(void);
void main ()
function1();
}
void function1(void)
{
int a;
int b;
int c;
int d;
int i=0;
int rooms;
printf("enter number of rooms\n");
scanf("%d",&rooms);
do
{
printf("Enter the price per meter of the tiles\n");
scanf("%d",&a);
printf("Enter the length\n");
scanf("%d",&b);
printf("Enter the breath\n");
scanf("%d",&c);
printf("Enter the grout type\ninferior qualtiy= 5$ /metre sq\nsuperior qualtiy= 7$ /metre sq\n");
scanf("%d",&d);
printf("Total area %d\n",b*c);
printf("Tile costings of room %d\n",a*b*c*d);
scanf("%c");
i++;
}
while(i!=rooms);
}
I have got this program that helps a tile layer to calculate the pricing of each room of a house and I am currently stuck on how to make the grand total of the rooms, each room has its own total and I require help to have the grand total price of the rooms =/
Jonathan_5
0
Newbie Poster
Recommended Answers
Jump to PostTo find the grand total, have a sum outside of the loop, and add every total to the sum every iteration. Ie:
... int sum = 0; do { ... sum += a*b*c*d; } while (i != rooms)
Some other things wrong with your code:
1. …
All 3 Replies
Hiroshe
499
Posting Whiz in Training
Jonathan_5
0
Newbie Poster
Hiroshe
499
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.