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; }
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;
}
0
as dev said else statement should be written outside if



