Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package practice1;
- /**
- *
- * @author valik888
- */
- import java.io.*;
- import java.util.*;
- public class mainClass {
- public static void main(String[] args) throws IOException {
- System.out.println("Введите сторону квадрата: ");
- double a, answer;
- BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
- Scanner sc = new Scanner(System.in);
- /* double a = Double.parseDouble(sc.nextDouble()); */
- String str = bf.readLine();
- a = Double.parseDouble(str);
- if(a <=0 ){
- System.out.println("Ошибка ввода!");
- } else {
- answer = a * a;
- System.out.println("Площадь квадрата равна: " + answer);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement