Problem :
Read de employee salary, calculate and print the new employee salary, as well the Money earned and the increase percentual obtained by the employee, with corresponding messages in Portuguese, as the below example.
Salary Increase
By Neilor Tonin, URI Brazil
Timelimit: 1
The enterprise ABC had decided to give a salary increase to his employees, according de following table:
Read de employee salary, calculate and print the new employee salary, as well the Money earned and the increase percentual obtained by the employee, with corresponding messages in Portuguese, as the below example.
Input
The input contains only a floating-point number, with 2 digits after the decimal point.
Output
Print 3 messages followed by the corresponding numbers (see example) informing the new salary, the among of money earned and the percentual obtained by the employee. Note:
Novo salario: means "New Salary"
Reajuste ganho: means "Money earned"
Em percentual: means "In percentage"
Novo salario: means "New Salary"
Reajuste ganho: means "Money earned"
Em percentual: means "In percentage"
Sample Input | Sample Output |
400.00 | Novo salario: 460.00 Reajuste ganho: 60.00 Em percentual: 15 % |
800.01 | Novo salario: 880.01 Reajuste ganho: 80.00 Em percentual: 10 % |
2000.00 | Novo salario: 2140.00 Reajuste ganho: 140.00 Em percentual: 7 % |
Solution:
#include <stdio.h>
int
main() {
char
c =
'%'
;
float
input,total,increase;
scanf
(
"%f"
,&input);
if
(input<= 400.00)
{
increase=(input*15)/100;
total=input+increase;
printf
(
"Novo salario: %.2f\n"
,total);
printf
(
"Reajuste ganho: %.2f\n"
,increase);
printf
(
"Em percentual: 15 %c\n"
,c);
}
else
if
(input >= 400.01 && input <= 800.00)
{
increase=(input*12)/100;
total=input+increase;
printf
(
"Novo salario: %.2f\n"
,total);
printf
(
"Reajuste ganho: %.2f\n"
,increase);
printf
(
"Em percentual: 12 %c\n"
,c);
}
else
if
(input>=800.01 && input <= 1200.00)
{
increase=(input*10)/100;
total=input+increase;
printf
(
"Novo salario: %.2f\n"
,total);
printf
(
"Reajuste ganho: %.2f\n"
,increase);
printf
(
"Em percentual: 10 %c\n"
,c);
}
else
if
(input>=1200.01 && input <= 2000.00)
{
increase=(input*7)/100;
total=input+increase;
printf
(
"Novo salario: %.2f\n"
,total);
printf
(
"Reajuste ganho: %.2f\n"
,increase);
printf
(
"Em percentual: 7 %c\n"
,c);
}
else
{
increase=(input*4)/100;
total=input+increase;
printf
(
"Novo salario: %.2f\n"
,total);
printf
(
"Reajuste ganho: %.2f\n"
,increase);
printf
(
"Em percentual: 4 %c\n"
,c);
}
return
0;
}
No comments:
Post a Comment