///tính tiền điện trong lập trình c
/*
0->99kwh don gia la 1000d
100->199kwh don gia la 1500d
200kwh tro len don gia la 2500d
*/
#include<stdio.h>
#include<math.h>
void main()
{
int a = 0, b = 0, c = 0, x, t;
printf_s("nhap vao so kwh dien can tinh tien:\n");
scanf_s("%d", &x);
if (x>199)
{
a = 99;
b = 100;
c = x - 199;
}
else if (x>99)
{
a = 99;
b = x - 99;
}
else a = x;
t = 1000 * a + 1500 * b + 2500 * c;
printf_s("so tien can phai tra la:%d d\n", t);
}
/*
0->99kwh don gia la 1000d
100->199kwh don gia la 1500d
200kwh tro len don gia la 2500d
*/
#include<stdio.h>
#include<math.h>
void main()
{
int a = 0, b = 0, c = 0, x, t;
printf_s("nhap vao so kwh dien can tinh tien:\n");
scanf_s("%d", &x);
if (x>199)
{
a = 99;
b = 100;
c = x - 199;
}
else if (x>99)
{
a = 99;
b = x - 99;
}
else a = x;
t = 1000 * a + 1500 * b + 2500 * c;
printf_s("so tien can phai tra la:%d d\n", t);
}