#include<stdio.h>
#include<conio.h>
main()
{
float salary,total;
int year,i,temp;
printf(“Enter your first salary:”);
scanf(“%f”,&salary);
printf(“Enter years for calculate:”);
scanf(“%d”,&year);
if (year<0) printf(“Error”); else
if (year==0) printf(“Total deposit in year %d is 0 bath.\n”,year); else
{
//first year
total = 12*0.1*salary;
if ((year>1)&&(year<=5))
{
for(i=2;i<=year;i++)
{
salary = salary*1.06;
if (salary-(0.1*salary + 5000)>=9000)
{
total = total + 12*0.1*salary;
}
}
printf(“Total deposit in year %d is %.2f bath.\n”,year,total);
}
if ((year>1)&&(year>5))
{
for(i=2;i<=5;i++)
{
salary = salary*1.06;
if (salary-(0.1*salary + 5000)>=9000)
{
total = total + 12*0.1*salary;
}
}
for(i=6;i<=year;i++)
{
salary = salary*1.06;
total = total + 12*0.1*salary;
}
printf(“Total deposit in year %d is %.2f bath.\n”,year,total);
}
}
getch();
}
-
เรื่องล่าสุด
- ดูรายงานการเช็คชื่อเข้าเรียนรอบ 3 (วันที่ 19 เม.ย.-3พ.ค.63) เมษายน 26, 2020
- วิชาการออกแบบ และพัฒนาเว็บไซต์ ปวส.2/3-2(2) และปวส.1/3-2(2)รอบ 3วันที่ 19 เม.ย.-3พ.ค.63) มีนาคม 21, 2020
- การคำนวณหาพื้นที่วงกลมปวส.1/3-2(2)และ ปวส.2/3-2กลางปีรอบ 3วันที่ 19 เม.ย.-3พ.ค.63) สิงหาคม 4, 2019
- หาพื้นที่สี่เหลี่ยมผืนผ้าปวส.1/3-2(2)และ ปวส.2/3-2กลางปีรอบ 3วันที่ 19 เม.ย.-3พ.ค.63) กรกฎาคม 28, 2019
- โปรแกรมสูตรคูณปวส.1/3-2(2)และ ปวส.2/3-2กลางปีรอบ 3วันที่ 19 เม.ย.-3พ.ค.63) กรกฎาคม 28, 2019
กรกฎาคม 2018 อา. จ. อ. พ. พฤ. ศ. ส. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31