Problem :
Salary with Bonus
Adapted by Neilor Tonin, URI Brazil
Timelimit: 1
You have to calculate the final salary for your employee, based on value sold by him. So you have to read his name, his fixed salary and the value sold by him. Your functionary wins 15% over all products sold. Write the final (total) salary of this functionary, rounded to two decimal places.
- Don’t forget to print end line after the result otherwise you will get “Presentation Error”.
- Don’t forget the blank spaces.
Input
The input file contains an string (employee first name), and two double values, that are the salary of this employee and the total value sold by him.
Output
Print the total salary of the employee, according to the given example.
Sample Inputs | Sample Outputs |
JOAO 500.00 1230.30 | TOTAL = R$ 684.54 |
PEDRO 700.00 0.00 | TOTAL = R$ 700.00 |
MANGOJATA 1700.00 1230.50 | TOTAL = R$ 1884.58 |
Solution:
#include <stdio.h>
int
main() {
char
c[15];
double
salary , sold, TOTAL;
scanf
(
"%s %lf %lf"
,&c,&salary,&sold);
TOTAL = salary + ((sold*15)/100);
printf
(
"TOTAL = R$ %.2lf\n"
,TOTAL);
return
0;
}
No comments:
Post a Comment