pesquisa

URI PROBLEMA 1038 - Lanche EM C

URI Online Judge | 1038

Lanche

Adaptado por Neilor Tonin, URI  Brasil
Timelimit: 1
Com base na tabela abaixo, escreva um programa que leia o código de um item e a quantidade deste item. A seguir, calcule e mostre o valor da conta a pagar.

Entrada

O arquivo de entrada contém dois valores inteiros correspondentes ao código e à quantidade de um item conforme tabela acima.

Saída

O arquivo de saída deve conter a mensagem "Total: R$ " seguido pelo valor a ser pago, com 2 casas após o ponto decimal.


URI Online Judge | 1038

Snack

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
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 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.















#include <stdio.h>




int main() {

int X,Y;




scanf("%d %d",&X,&Y);

if (X==1)

printf("Total: R$ %.2f\n",4.00*Y);

else

if (X==2)

printf("Total: R$ %.2f\n",4.50*Y);

else

if (X==3)

printf("Total: R$ %.2f\n",5.00*Y);

else

if (X==4)

printf("Total: R$ %.2f\n",2.00*Y);

else

if (X==5)

printf("Total: R$ %.2f\n",1.50*Y);




return 0;

}

Postar um comentário

0 Comentários