[URI Online Judge] – 1008 – Salary

Write a program that reads the number of an employee, the number of hours that he worked in a month and the amount he received per hour. Print the employee number and the salary that he will receive at end of the month, 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 space before and after the equal signal and after the U$.

Input

The input file contains 2 integer numbers and 1 floating-point number, respectively the number, hours worked and the among received by an hour worked.

Output

Print the number and the salary of the employee, according to the given example, with a blank space before and after the equal signal.

Sample Input Sample Output
25
100
5.50
NUMBER = 25
SALARY = U$ 550.00
1
200
20.50
NUMBER = 1
SALARY = U$ 4100.00
6
145
15.55
NUMBER = 6
SALARY = U$ 2254.75

Solution:

#include <cstdio>

int main(){
int a, b;
float c;
scanf(“%d”, &a);
scanf(“%d”, &b);
scanf(“%f”, &c);
printf(“NUMBER = %d\n”, a);
printf(“SALARY = U$ %.2f\n”, c * b);
return 0;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s