728x90
import java.util.Scanner;
public class scan {
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int a=1, b=1;
while(a+b!=0)
{
System.out.print("정수 2개 입력(피제수 제수 순으로 입력) : ");
a = sc.nextInt();
b = sc.nextInt();
if(b!=0)
System.out.println(a + " 나누기 " + b + " : 몫" + (a/b) + ", 나머지 " + (a%b));
else if(a!=0)
System.out.println("제수가 0이면 안 된다.");
}
System.out.println("종료합니다.");
}
}
'it > programming' 카테고리의 다른 글
| [JAVA] a 와 b 사이의 정수의 합 구하기 (2) | 2013.03.27 |
|---|---|
| [JAVA] 입출력, 연산자, 제어문 (0) | 2013.03.27 |
| [HTML] 130321 웹프밍 수업 - table 태그 (0) | 2013.03.21 |