(URI) Área - Solução
import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String linha = br.readLine();
StringTokenizer tokenizer = new StringTokenizer(linha);
double a = Double.parseDouble(tokenizer.nextToken());
double b = Double.parseDouble(tokenizer.nextToken());
double c = Double.parseDouble(tokenizer.nextToken());
System.out.print("TRIANGULO: ");
System.out.printf("%.3f\n", (a*c)/2);
System.out.print("CIRCULO: ");
System.out.printf("%.3f\n", 3.14159*(c*c));
System.out.print("TRAPEZIO: ");
System.out.printf("%.3f\n", ((a+b)*c)/2);
System.out.print("QUADRADO: ");
System.out.printf("%.3f\n", b*b);
System.out.print("RETANGULO: ");
System.out.printf("%.3f\n", a*b);
}
}
import java.util.*;
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String linha = br.readLine();
StringTokenizer tokenizer = new StringTokenizer(linha);
double a = Double.parseDouble(tokenizer.nextToken());
double b = Double.parseDouble(tokenizer.nextToken());
double c = Double.parseDouble(tokenizer.nextToken());
System.out.print("TRIANGULO: ");
System.out.printf("%.3f\n", (a*c)/2);
System.out.print("CIRCULO: ");
System.out.printf("%.3f\n", 3.14159*(c*c));
System.out.print("TRAPEZIO: ");
System.out.printf("%.3f\n", ((a+b)*c)/2);
System.out.print("QUADRADO: ");
System.out.printf("%.3f\n", b*b);
System.out.print("RETANGULO: ");
System.out.printf("%.3f\n", a*b);
}
}
Comments
Post a Comment