Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- void solution();
- void main(void)
- {
- solution();
- }
- void solution()
- {
- int w_num, b_num, f_num;
- printf("Enter number of windows: ");
- scanf_s("%d", &w_num);
- printf("Enter number of balconys: ");
- scanf_s("%d", &b_num);
- loop:
- printf("Enter floor number: ");
- scanf_s("%d", &f_num);
- if (f_num > 0) {
- unsigned int summary_cost = 0, b_cost = 0, w_cost = 0;
- double w_sq = 0, b_sq = 0;
- if (f_num == 1) {
- w_cost = w_num * 100;
- w_sq = 2.15 * 1.5 * w_num;
- b_cost = b_num * 150;
- b_sq = 0.7 * 2.15 * 150;
- summary_cost = w_cost + b_cost;
- }
- else {
- printf("Windows price with 15 percentage for every window & square: ");
- w_cost = static_cast<int>(w_num * 100 * 1.15);
- w_sq = 2.15 * 1.5 * w_num;
- b_cost = b_num * 150;
- b_sq = 0.7 * 2.15 * 150;
- summary_cost = w_cost + w_cost;
- }
- printf("Price for windows & square: ");
- printf("%d\t%6.3f\n", w_cost, w_sq);
- printf("Price for balconys & square: ");
- printf("%d\t%6.3f\n", b_cost, b_sq);
- printf("Cost in dollars: ");
- printf("%d", summary_cost);
- }
- else {
- printf("Wrong floor number: ");
- goto loop;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement