Sovan Prusty

Sovan Prusty

  • NA
  • 2
  • 437

C code is compiling but not giving the desired output.

Dec 4 2016 7:42 PM
I am a beginner. I am trying to write a simple code to calculate the salary. although it is getting compiled but I am not being able to get the desired output.
 
#include
int main()
{
float a, b, c, d;

printf("Basic salary = \n");
scanf("%f", &a);
b = (40/100)*a;
c = (20/100)*a;
d = b + c;

printf("Gross Salary = %f\n", a+d);
return 0;


}
 
 
If I put Basic salary as = 1000.00
I should get Gross salary as 1600.00
but I am getting gross salary same as the basic salary.
please help!

Answers (1)