-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheje1595.java
More file actions
34 lines (33 loc) · 1022 Bytes
/
eje1595.java
File metadata and controls
34 lines (33 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.util.Scanner;
public class eje1595
{
public static void main(String [] arg){
Scanner lee = new Scanner(System.in);
while(true){
String num1 = lee.nextLine();
if(num1.equals("0")) break;
String num = num1;
int cont=0;
while(true){
int x=0;
for(int i=0; i<num.length(); i++){
x += Integer.parseInt(""+num.charAt(i));
}
cont+=1;
if((x+"").length()==1){
if(x==9){
System.out.println(num1+" is a multiple of 9 and has 9-degree "+cont+".");
break;
}
else{
System.out.println(num1+" is not a multiple of 9.");
break;
}
}
else{
num = ""+x;
}
}
}
}
}