URI Online Judge | 1012
Área
Adaptado por Neilor Tonin, URI
Brasil
Timelimit: 1
BrasilEscreva um programa que leia três valores com ponto flutuante de dupla precisão: A, B e C. Em seguida, calcule e mostre:
a) a área do triângulo retângulo que tem A por base e C por altura.
b) a área do círculo de raio C. (pi = 3.14159)
c) a área do trapézio que tem A e B por bases e C por altura.
d) a área do quadrado que tem lado B.
e) a área do retângulo que tem lados A e B.
a) a área do triângulo retângulo que tem A por base e C por altura.
b) a área do círculo de raio C. (pi = 3.14159)
c) a área do trapézio que tem A e B por bases e C por altura.
d) a área do quadrado que tem lado B.
e) a área do retângulo que tem lados A e B.
Entrada
O arquivo de entrada contém três valores com um dígito após o ponto decimal.
Saída
O arquivo de saída deverá conter 5 linhas de dados. Cada linha corresponde a uma das áreas descritas acima, sempre com mensagem correspondente e um espaço entre os dois pontos e o valor. O valor calculado deve ser apresentado com 3 dígitos após o ponto decimal.
URI Online Judge | 1012
Area
Adapted by Neilor Tonin, URI
Brazil
Timelimit: 1
BrazilMake a program that reads three floating point values: A, B and C. Then, calculate and show:
a) the area of the rectangled triangle that has base A and height C.
b) the area of the radius's circle C. (pi = 3.14159)
c) the area of the trapezium which has A and B by base, and C by height.
d) the area of the square that has side B.
e) the area of the rectangle that has sides A and B.
a) the area of the rectangled triangle that has base A and height C.
b) the area of the radius's circle C. (pi = 3.14159)
c) the area of the trapezium which has A and B by base, and C by height.
d) the area of the square that has side B.
e) the area of the rectangle that has sides A and B.
Input
The input file contains three double values with one digit after the decimal point.
Output
The output file must contain 5 lines of data. Each line corresponds to one of the areas described above, always with a corresponding message (in Portuguese) and one space between the two points and the value. The value calculated must be presented with 3 digits after the decimal point.
#include <stdio.h>
int main() {
float A,B,C;
scanf("%f %f %f",&A,&B,&C);
printf("TRIANGULO: %.3f\n",A*C/2);
printf("CIRCULO: %.3f\n",3.14159*C*C);
printf("TRAPEZIO: %.3f\n",(A+B)*C/2);
printf("QUADRADO: %.3f\n",B*B);
printf("RETANGULO: %.3f\n",A*B);
return 0;
}
Nenhum comentário:
Postar um comentário