본문 바로가기
프로그래밍/JAVA

[예제]5의 배수 구별하기

by Edgemine 2017. 4. 29.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package Th;
 
import java.util.Scanner;
public class Happy {
   public static void main(String arg[])
   {
       int num1;
      
       Scanner s = new Scanner(System.in);
       System.out.println("숫자?");
       num1 = s.nextInt();
       num1 = num1%5;
       if(num1 == 0)
       {
           System.out.println("5의 배수");
       }
       else
       {
           System.out.println("5의배수아님");
       }
       //종료
       s.close();
   }
}
cs

5의 배수를 구별하는 예제입니다