Please help me, I already made a programm it run good if i only input a first name but if i input first and last name it did'nt work properly
here is the program i made and the output of the program
PROGRAM
#include <stdio.h>
#include <conio.h>
#include<math.h>
char a,name;
double x,y,z,b,c,d,late,ot,ot1,ot2,xin,wrk,grs,tax,phil,sss,td,net,net1;
main()
{
char name[20];
printf("Employee Name:\t\t\t");
scanf("%8s", &name);
printf("Number of hours work:\t\t");
scanf("%lf", &x);
printf("Extra hours work (OT):\t\t");
scanf("%lf", &y);
printf("Number of hours late(UT):\t");
scanf("%lf", &z);
printf("Rate per hour:\t\t\t");
scanf("%lf", &b);
printf("Food deduction:\t\t\t");
scanf("%lf", &c);
printf("Extra income:\t\t\t");
scanf("%lf", &d);
a=(char)name;
printf("\n\tEmployee Name: %s\t\t",name);
scanf("%c", &name);
late=(float)z*b;
printf("\n\tUndertime pay: %5.2lf\t\t",late);
ot1=(float)b*0.04*y;
ot2=(double)y*b;
ot=(double) ot1+ot2;
printf("\n\tOvertime pay: %5.2lf\t\t",ot);
xin=(float)d;
printf("\n\tExtra income: %5.2lf\t\t",xin);
ot1=(float)b*0.04*y;
ot2=(double)y*b;
ot=(double) ot1+ot2;
wrk=(double)x*b;
grs=(double)ot+wrk;
printf("\n\tGross pay: %5.2lf\t\t\t",grs);
ot1=(float)b*0.04*y;
ot2=(double)y*b;
ot=(double) ot1+ot2;
wrk=(double)x*b;
grs=(double)ot+wrk;
tax=grs*.15;
phil=grs*.025;
sss=grs*.04;
late=(double)z*b;
td=(double)tax+phil+sss+c+late;
net1=(double)grs-td;
net=(double)net1+d;
printf("\n\tNet pay: %5.2lf\t\t\t",net);
getch();
}
WHEN I INPUT ONLY FIRSTNAME ONLY IT WORKS PROPERLY
Employee Name: mark
Number of hours work: 240
Extrea hours work (OT): 52
Number of hours late(UT): 2
Rate per hour: 100
Food deduction: 300
Extra income: 1250
Employee Name: mark
Undertime pay: 200.00
Overtime pat: 5408.00
Extra income: 1250.00
Gross pay: 29408.00
Net pay: 23835.28
----------------------------------------------
BUT WHEN I INPUT BOTH FIRST AND LAST NAME THIS HAPPENED
Employee Name: mark gwapo
Number of hours work: Extrea hours work (OT): Number of hours
late(UT): Rate per hour: Food deduction:
Extra income:
Employee Name: mark
Undertime pay: 0.00
Overtime pat: 0.00
Extra income: 0.00
Gross pay: 0.00
Net pay: 0.00