Tech
Forums
Jobs
Books
Events
Live
Interviews Prep
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
C code is compiling but not giving the desired output.
Sovan Prusty
Dec 4 2016 7:42 PM
182
Reply
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!
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
command arguments
C# Class and three tier architecture