Untitled
unknown
python
2 years ago
1.2 kB
2
Indexable
#include <stdio.h> #include <stdlib.h> int main() { int wbp,ebp,hrp; int wbn,ebn,hrn; int totalb,totalp; char perc[] = "%"; printf("Water Consumption a Month 0-100%: "); scanf("%i", &wbp); printf("Electric Consumption a Month 0-100%: "); scanf("%i", &ebp); printf("House Rent 1500-10000: "); scanf("%i", &hrn); system("cls"); if (wbp >= 1 && wbp <=100 && ebp >=1 && ebp <=100 && hrn >= 1500 && hrn <= 10000){ if(wbp >= 1 && wbp <=100){ wbn = pow(wbp,2)/2; printf("%Water Bill = %iphp or %i%s\n", wbn,wbp,perc); } if (ebp >= 1 && ebp <= 100){ ebn = pow(ebp,2)/1.25; printf("Electric Bill = %iphp or %i%s\n", ebn,ebp,perc); } if (hrn >= 1500 && hrn <= 10000){ hrp = hrn/100; printf("House Rent = %iphp or %i%s\n", hrn, hrp, perc); } totalb = wbn+ebn+hrn; totalp = (wbp+ebp+hrp)/3; printf("Total Amount of Bills = %i", totalb); printf("Total Percentage of Bills = %i", totalp); } else if (wbp <= 0 || wbp > 100 || ebp <= 0 || ebp >100 || hrn < 1500 || hrn > 10000){ printf("Error!"); } return 0; }
Editor is loading...