URI - BEECROWD - BEE Online Judge Solution 1038 | Snake - URI - BEECROWD - BEE 1038 Solution in C,C++,Python
Using the following table, write a program that reads a code and the amount of an item. After, print the value to pay. This is a very simple program with the only intention of practice of selection commands.
Input
The input file contains two integer numbers X and Y. X is the product code and Y is the quantity of this item according to the above table.
Output
The output must be a message "Total: R$ " followed by the total value to be paid, with 2 digits after the decimal point.
Input Sample | Output Sample |
3 2 | Total: R$ 10.00 |
4 3 | Total: R$ 6.00 |
2 3 | Total: R$ 13.50 |
URI Online Judge Solution 1038 | Snake - URI 1038 Solution in C,C++,Python :
#include<stdio.h>
int main()
{
int X, Y;
float price = 0;
scanf("%d %d", &X, &Y);
if (X == 1)
{
price = (float) (4.00 * Y);
}
else if (X == 2)
{
price = (float) (4.50 * Y);
}
else if (X == 3)
{
price = (float) (5.00 * Y);
}
else if (X == 4)
{
price = (float) (2.00 * Y);
}
else if (X == 5)
{
price = (float) (1.50 * Y);
}
printf("Total: R$ %.2f\n",price);
}
0 Response to URI - BEECROWD - BEE 1038 | Snake Solution in C,C++,Python
Post a Comment