Task 6-Tax - Solution
Using the if-else command, it is checked whether the salary in euros is higher than 1000. If it is in the formula for calculating the tax, the value 0.2 = 20.0 / 100 * salary EUR is used (20% is tax), and if not then 0.15 (15.0 / 100 * salaryEUR).
Solution:#include <stdio.h>
#include <stdlib.h>
int main()
{
double salaryRSD,salaryEUR,tax,exchangeRate;
exchangeRate=117.0;
printf("Enter the salary in RSD\n");
scanf("%lf",&salaryRSD);
/*calculate salary in euros*/
salaryEUR=salaryRSD/exchangeRate;
//Check if whether the salary is higher than 100 EUR
if(salaryEUR>=1000)
{
tax=0.2*salaryEUR; //If yes tax is (20.0 / 100) * salary
}
else
{
tax=0.15*salaryEUR; //If not tax is (15.0 / 100) * salary
}
printf("Tax is %.2f\n",tax);
return 0;
}
