Ad Code

Responsive Advertisement

Uri - Beecrowd | 1038 | Snack

beecrowd | 1038

Snack

Adapted by Neilor Tonin, URI Brazil


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.

snack price uri 1038 solution

Input

The input file contains two integer numbers and Yis the product code and 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

N.B.: It's better if you solve this by your own. Thank you!

  URI - BEECROWD Online Judge 1038 Solve  in C :                                          

// Solved by Intesar
#include <stdio.h>
int main()
{
    int X, Y;
    scanf("%d%d", &X, &Y);

    if (X == 1)
        printf("Total: R$ %.2f\n", 4.00 * (float)Y);
    else if (X == 2)
        printf("Total: R$ %.2f\n", 4.50 * (float)Y);
    else if (X == 3)
        printf("Total: R$ %.2f\n", 5.00 * (float)Y);
    else if (X == 4)
        printf("Total: R$ %.2f\n", 2.00 * (float)Y);
    else if (X == 5)
        printf("Total: R$ %.2f\n", 1.50 * (float)Y);
    return 0;
}

Post a Comment

0 Comments

Ad Code

Responsive Advertisement