Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int yos;
- double salary;
- char time;
- printf("Please enter your employee status, 'P' for Fulltime and 'P' for Parttime: n");
- scanf_s("%c", &time);
- printf("Please enter your year of service: n");
- scanf_s("%d", &yos);
- printf("Please enter your current salary: n");
- scanf_s("%lf", &salary);
- switch (time)
- {
- case 'F':
- case 'f':
- if (yos >= 5)
- {
- salary = (salary*5.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- else if (yos < 5 )
- {
- salary = (salary*4.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- break;
- case 'P':
- case 'p':
- if (yos >= 5)
- {
- salary = (salary*3.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- else if (yos < 5 )
- {
- salary = (salary*2.5 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- break;
- default:
- printf("Please put the details correctlyn");
- }
- return(0);
- }
- Please enter your employee status, 'P' for Fulltime and 'P' for Parttime:
- F
- Please enter your year of service:
- 6
- Please enter your current salary:
- 200
- Please put the details correctly
- Press any key to continue
- #include<stdio.h>
- int main()
- {
- int yos;
- double salary;
- char time;
- printf("Please enter your employee status, 'P' for Fulltime and 'P' for Parttime: n");
- scanf_s("%c", &time);
- printf("Please enter your year of service: n");
- scanf_s("%d", &yos);
- printf("Please enter your current salary: n");
- scanf_s("%lf", &salary);
- if (char time == 'F' && yos >= 5)
- {
- salary = (salary*5.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- else if (char time == 'F' && yos < 5)
- {
- salary = (salary*4.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- if (char time == 'P' && yos >= 5)
- {
- salary = (salary*3.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- else if (char time == 'P' && yos < 5)
- {
- salary == (salary*2.5 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- return(0);
- }
- error c2143 missing ',' before '==' at line 15, 21, 27...
- Warning 11 warning C4553: '==' : operator has no effect; did you intend '='?
- #include<stdio.h>
- int main() {
- int yos;
- double salary;
- char time;
- printf("Please enter your employee status, 'F' for Fulltime and 'P' for Parttime: n");
- scanf("%c", &time);
- printf("Please enter your year of service: n");
- scanf("%d", &yos);
- printf("Please enter your current salary: n");
- scanf("%lf", &salary);
- switch (time) {
- case 'F':
- case 'f':
- if (yos >= 5) {
- salary = (salary * 5.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- else if (yos < 5) {
- salary = (salary * 4.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- break;
- case 'P':
- case 'p':
- if (yos >= 5) {
- salary = (salary * 3.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- else if (yos < 5) {
- salary = (salary * 2.5 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- break;
- default:
- printf("Please put the details correctlyn");
- }
- return (0);
- }
- Please enter your employee status, 'F' for Fulltime and 'P' for Parttime:
- F
- Please enter your year of service:
- 6
- Please enter your current salary:
- 200
- Your new salary is 210.00
- #include<stdio.h>
- int main()
- {
- int yos;
- double salary;
- char time;
- printf("Please enter your employee status, 'P' for Fulltime and 'P' for Parttime: n");
- scanf("%c", &time);
- printf("Please enter your year of service: n");
- scanf("%d", &yos);
- printf("Please enter your current salary: n");
- scanf("%lf", &salary);
- if (time == 'F' && yos >= 5)
- {
- salary = (salary*5.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- else if (time == 'F' && yos < 5)
- {
- salary = (salary*4.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- if (time == 'P' && yos >= 5)
- {
- salary = (salary*3.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- else if (time == 'P' && yos < 5)
- {
- salary == (salary*2.5 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- return(0);
- }
- #include<stdio.h>
- int main()
- {
- int yos;
- double salary;
- char time;
- printf("Please enter your employee status, 'F' for Fulltime and 'P' for Parttime: n");
- scanf("%c", &time);
- printf("Please enter your year of service: n");
- scanf("%d", &yos);
- printf("Please enter your current salary: n");
- scanf("%lf", &salary);
- int status;
- if(time=='F'||time=='f')
- status = 1;
- if(time=='P'||time=='p')
- status = 2;
- switch (status)
- {
- case 1:
- if (yos >= 5)
- {
- salary = (salary*5.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- else if (yos < 5 )
- {
- salary = (salary*4.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- break;
- case 2:
- if (yos >= 5)
- {
- salary = (salary*3.0 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- else if (yos < 5 )
- {
- salary = (salary*2.5 / 100.0) + salary;
- printf("nYour new salary is %.2lf", salary);
- }
- break;
- default:
- printf("Please put the details correctlyn");
- }
- return(0);
- }
- char c;
- scanf_s("%c", &c, 1);
- scanf_s("%c", &time, 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement