0

Can you please solve the program's problem

#include <stdio.h> int main() { int salary,bonus,totalamt,dis; dis=15; printf("enter the salary"); scanf("%d",&salary); if(salary>=20000) { bonus =salary*10/100; totalamt =salary+bonus; printf("the salary is%d",salary); printf("the totalamt is %d",totalamt ); else printf ("you are not able to pick bonus"); } return 0; }

2nd Jun 2018, 7:37 AM
SHIV RATAN VISHWAKARMA
SHIV RATAN VISHWAKARMA - avatar
2 Answers
+ 3
// This is the fixed code. #include <stdio.h> int main() { int salary,bonus,totalamt; printf("enter the salary"); scanf("%d",&salary); if(salary>=20000) { bonus =salary*10/100; totalamt =salary+bonus; printf("the salary is%d",salary); printf("the totalamt is %d",totalamt ); } else { printf ("you are not able to pick bonus"); } return 0; }
2nd Jun 2018, 7:48 AM
Dev
Dev - avatar
0
as dev said else statement should be written outside if
2nd Jun 2018, 7:54 AM
‎ ‏‏‎Anonymous Guy