Sunday, April 3, 2016

URI 1008 Solution in C, C++ and java language


URI Online Judge Solution  1008

Salary

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Write a program that reads an employee's number, his/her worked hours number in a month and the amount he received per hour. Print the employee's number and salary that he/she will receive at end of the month, with two decimal places.
  • Don’t forget to print the line's end after the result, otherwise you will receive “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 value of floating point, representing the number, worked hours amount and the amount the employee receives per worked hour.

Output

Print the number and the employee's salary, according to the given example, with a blank space before and after the equal signal.
Input SamplesOutput Samples
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



URI 1008 Solution in C language:



  1. #include <stdio.h>
  2. int main()
  3. {
  4. int a,b;
  5. float c;
  6. scanf("%d%d%f", &a, &b, &c);
  7. printf("NUMBER = %d\n", a);
  8. printf("SALARY = U$ %.2f\n", b * c);
  9. return 0;
  10. }

URI 1008 Solution in C++ language:


  1. #include <cstdio>
  2. int main()
  3. {
  4. int a,b;
  5. float c;
  6. scanf("%d%d%f", &a, &b, &c);
  7. printf("NUMBER = %d\n", a);
  8. printf("SALARY = U$ %.2f\n", b * c);
  9. return 0;
  10. }

URI 1008 Solution in java language:


  1. import java.util.Scanner;
  2. public class URI_1008 {
  3. public static void main(String[] args){
  4. int a,b;
  5. float c;
  6. Scanner sc =new Scanner(System.in);
  7. a = sc.nextInt();
  8. b = sc.nextInt();
  9. c = sc.nextFloat();
  10. System.out.printf("NUMBER = %d\n", a);
  11. System.out.printf("SALARY = U$ %.2f\n", b * c);
  12. }
  13. }

No comments:
Write comments

To know more about the problem, give us your valuable commment. We'll try to help you. Thanks

All rights reserved ©2016 -URI ONLINE JUDGE SOLUTION | Developed by Maniruzzaman Akash

© 2016 URI ONLINE JUDGE SOLUTION. Developed by Maniruzzaman Akash | Distributed By Gooyaabi Templates
Powered by Blogger.