Hi everyone I was hoping i could get some help regarding a problem I've been stuck over for the past hour.As far as my understanding of the C is concerned code seems perfectly fine and should work without a hitch.
#include<stdio.h>
void main(){
int salary;
float net_salary;
printf("Please enter your salary.\n");
scanf("%d", &salary);
if(salary >= 2000){
net_salary = salary - ((7/100)*salary);
printf("Your net salary is %f." ,net_salary);
}
else if(salary >= 10000 && salary < 20000){
net_salary = salary - 1000;
printf("Your net salary is %f.",net_salary);
}
}
The above code returns the following result when I enter 12000 gives the following result.
Please enter your salary.
12000
Your net salary is 12000.000000.
and for 6000 it returns
Please enter your salary.
6000
Your net salary is 6000.000000.
Any help would be greatly appreciated, thank you in advance.