Thursday, May 26, 2016

URI Online Judge Solution 1010 || Simple Calculate


URI Online Judge | 1010

Simple Calculate

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
In this problem, the task is to read a code of a product 1, the number of units of product 1, the price for one unit of product 1, the code of a product 2, the number of units of product 2 and the price for one unit of product 2. After this, calculate and show the amount to be paid.

Input

The input file contains two lines of data.\ In each line there will be 3 values: two integers and a floating value with 2 digits after the decimal point.

Output

The output file must be a message like the following example where "Valor a pagar" means Value to Pay. Remember the space after ":" and after "$" symbol. The value must be presented with 2 digits after the point.
Input SamplesOutput Samples
12 1 5.30
16 2 5.10
VALOR A PAGAR: R$ 15.50
13 2 15.30
161 4 5.20
VALOR A PAGAR: R$ 51.40
1 1 15.10
2 1 15.10
VALOR A PAGAR: R$ 30.20


URI Online Judge Solution 1010 || Simple Calculate in C


#include<stdio.h>
int main(){
 
    int product1_code, product1_number, product2_code, product2_number;
    float product1_price, product2_price, product1_paid, product2_paid, all_paid;
    scanf("%d %d %f", &product1_code, &product1_number, &product1_price);
    scanf("%d %d %f", &product2_code, &product2_number, &product2_price);
 
    product1_paid = product1_number * product1_price;
    product2_paid = product2_number * product2_price;
    all_paid = product1_paid + product2_paid ;
 
    printf("VALOR A PAGAR: R$ %.2f\n", all_paid);
}


See in Dropbox

Main link of URI : https://www.urionlinejudge.com.br/judge/en/problems/view/1010


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.