คำนวณหาค่าน้ำประปา

/

#include<stdio.h>

#include<conio.h>

#define VAT 7.0

 int main()

{

    int unit, unit_use, pay=0, service_charge;

    float bill = 0;

    printf(“\n Enter water unit : “);

    scanf(“%d”, &unit);

     if(unit > 100){

        unit_use = unit – 100;

        pay += unit_use * 15;

        unit -= unit_use;

    }

    if(unit > 40 && unit <= 100){

        unit_use = unit – 40;

        pay += unit_use * 10;

        unit -= unit_use;

    }

    if(unit > 20 && unit <= 40){

        unit_use = unit – 20;

        pay += unit_use * 7;

        unit -= unit_use;

    }

    if(unit > 10){

        pay += unit * 5;

    }

    printf(” Enter Service charge : “);

    scanf(“%d”, &service_charge);

    bill = pay + service_charge;

    printf(“\n\n Water bill before VAT is %.2f Bath”, bill);

    bill = bill * ( 1 + (VAT / 100));

    printf(“\n VAT %.2f%% is %.2f Bath”, VAT, (bill * VAT) / (100+VAT));

    printf(“\n\n Total water bill is %.2f Bath\n”, bill);

    getch();

}

ข้อความนี้ถูกเขียนใน ไม่มีหมวดหมู่ คั่นหน้า ลิงก์ถาวร