
| Turbo C - Salary Calculator |
|
#include<stdio.h> #include<conio.h> /* Programmed by Harvey Losin */ /* http://www.bikoy.com/harvey */ /* webmaster@bikoy.com */ main() { char name[80]; float workhrs, overtime, salary; clrscr(); printf("n Enter name: "); scanf("%s",&name); printf("n How many hours have you been working? "); scanf("%f",&workhrs); printf("nnn Press any key to compute salary..."); getch(); if(workhrs>45) { if(workhrs>=45 && workhrs<=55) { overtime=workhrs-45; salary=1350+(overtime*40); printf("nnn Hello %s! Your salary for this month is P%.2f",name,salary); } else { overtime=workhrs-45; salary=1350+(overtime*40)+200; printf("nnn Hello %s! Your salary for this month is P%.2f",name,salary); } } else { salary=workhrs*30; printf("nnn Hello %s! Your salary for this month is P%.2f",name,salary); } getch(); }
|