URI Online Judge | 1017
Gasto de Combustível
Adaptado por Neilor Tonin, URI
Brasil
Timelimit: 1
Joaozinho quer calcular e mostrar a quantidade de litros de combustível gastos em uma viagem, ao utilizar um automóvel que faz 12 KM/L. Para isso, ele gostaria que você o auxiliasse através de um simples programa. Para efetuar o cálculo, deve-se fornecer o tempo gasto na viagem (em horas) e a velocidade média durante a mesma (em km/h). Assim, pode-se obter distância percorrida e, em seguida, calcular quantos litros seriam necessários. Mostre o valor com 3 casas decimais após o ponto.
Entrada
O arquivo de entrada contém dois inteiros. O primeiro é o tempo gasto na viagem (em horas) e o segundo é a velocidade média durante a mesma (em km/h).
Saída
Imprima a quantidade de litros necessária para realizar a viagem, com três dígitos após o ponto decimal
URI Online Judge | 1017
Fuel Spent
Adapted by Neilor Tonin, URI
Brazil
Timelimit: 1
Little John wants to calculate and show the amount of spent fuel liters on a trip, using a car that does 12 Km/L. For this, he would like you to help him through a simple program. To perform the calculation, you have to read spent time (in hours) and the same average speed (km/h). In this way, you can get distance and then, calculate how many liters would be needed. Show the value with three decimal places after the point.
Input
The input file contains two integers. The first one is the spent time in the trip (in hours). The second one is the average speed during the trip (in Km/h).
Output
Print how many liters would be needed to do this trip, with three digits after the decimal point.
#include <stdio.h>
int main() {
float X,Y;
scanf("%f %f", &X,&Y);
printf("%.3f\n",(X*Y)/12);
return 0;
}
Nenhum comentário:
Postar um comentário