Simple Calculate
Adapted by Neilor Tonin, URI BrazilTimelimit: 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 “R$” symbol. The value must be presented with 2 digits after the point.
Input Samples | Output 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 |
Solution
#include <stdio.h>
int main()
{
int a1,a2,b1,b2;
float p1,p2,VAP;
scanf("%d%d%f",&a1,&b1,&p1);
scanf("%d%d%f",&a2,&b2,&p2);
VAP = (b1*p1)+(b2*p2);
printf("VALOR A PAGAR: R$ %.2f\n",VAP);
return 0;
}
- How to Use URI Online Judge to Improve Your Coding Skills and Boost Your Career
- BEST FREE GIFT CARD GENERATOR in 2022
- উইন্ডোজ 11 এসে গেল, নজরকাড়া লুক, তাক লাগানো ফিচার্স!
- URI 2694 Solved by C programming
- URI Online Solve | 1957 Converting to Hexadecimal- Solution
- Android custom toolbar Android Studio | Android Tutorial
- URI Online Judge | 1040 Solution | Average 3
- URI Online Judge | 1038 Solution |Snack
- URI Online Judge | 1037 Solution | Interval
- URI Online Judge | 1036 Solution | Bhaskara’s Formula
- URI Online Judge Solution| 1035 Selection Test 1
- URI Online Judge Solution| 1021 Banknotes and Coins
- URI Online Judge Solution| 1020 Age in Days
- URI Online Judge Solution| 1019 Time Conversion
- URI Online Judge Solution| 1018 Banknotes
- URI Online Judge Solution| 1017 Fuel Spent
- URI Online Judge Solution| 1016 Distance
- URI Online Judge Solution| 1015 Distance Between Two Points
- URI Online Judge Solution| 1014 Consumption
- URI Online Judge Solution| 1013 The Greatest