From e3cfd16d9d0ba6a7a36e2289722150d06ccdb2e1 Mon Sep 17 00:00:00 2001 From: monsileI Date: Mon, 4 Jul 2022 20:55:09 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B7=80=EB=82=A9=EB=B2=95=20=EC=A6=9D?= =?UTF-8?q?=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\352\267\200\353\202\251\353\262\225.java" | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 "Basic_Of_Algorithm/src/test/\352\267\200\353\202\251\353\262\225.java" diff --git "a/Basic_Of_Algorithm/src/test/\352\267\200\353\202\251\353\262\225.java" "b/Basic_Of_Algorithm/src/test/\352\267\200\353\202\251\353\262\225.java" new file mode 100644 index 0000000..ae7f8f7 --- /dev/null +++ "b/Basic_Of_Algorithm/src/test/\352\267\200\353\202\251\353\262\225.java" @@ -0,0 +1,34 @@ +package test; + +import java.util.Scanner;; + +public class 귀납법 { + + public static void main(String[] args) { + + + Scanner scan = new Scanner(System.in); + + int n = scan.nextInt(); + + int m = test(n); + + int l = 0; + + for(int i=n;i>-1;i--) { + l += i; + } + + if(l==m) System.out.println("이게 귀납법"); + + System.out.println(l); + System.out.println(m); + } + + static int test(int n) { + + if(n==0) return n; + return n+test(n-1); + + } +}