[Java] 정올기초다지기 함수1-자가진단02
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 package 함수1.자가진단02; import java.util.Scanner; public class Main { private static void circle(int num) { double out = num*num*3.14; System.out.printf("%.2f",out); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num= sc.nextInt(); circle(num); sc.close(); } } > circle 이라는 메소드를 생성하여 int num 값을 사용하여 원의 넓이를 구할 공식으로 out이라..
알고리즘/Jungol
2020. 3. 13. 19:58