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); + + } +}