1.

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 10922 2 the 9s
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=21&page=show_problem&problem=1863
*
* @author Anton Pavlushko, IBB7B,
* @version 1.0, 10/10/2010
*
* Status : Accepted
* Runtime: 0.288
*/

import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String start, current_line = "";
int i, number, summa, count, length;

try {
while ((current_line=in.readLine())!= null && !current_line.equals("0")) {
start=current_line;
summa=0;
count=0;
do {
summa=0;
length=current_line.length();
for(i=0;i<length;i++) {
summa+=Character.getNumericValue(current_line.charAt(i));
}
current_line=String.valueOf(summa);
} while (summa%9==0 && count++>=0 && summa!=9);

if (count>0)
System.out.println(start+" is a multiple of 9 and has 9-degree "+count+".");
else
System.out.println(start+" is not a multiple of 9.");

} // end while
} // end try
catch (IOException e) {
System.err.println("Error: " + e);
}
}
}


2.

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 10922 2the9s
*
* @author Robert Reichart
*
* Status : Accepted
* Runtime: 0.364
*/

import java.io.*;

class Main{
public static void main(String... args){
try{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line=in.readLine();
while(!line.equals("0")){
String linecopy=line;
int degree=0;
if (line.length()==1){degree=1;}
while(line.length()>1){
int x=0;
for (int i=0;i<line.length();i++){
x=x+Integer.parseInt(Character.toString(line.charAt(i)));
}
line=Integer.toString(x);
degree++;
}

if(line.equals("9")){
System.out.println(linecopy + " is a multiple of 9 and has 9-degree " + degree + ".");
}else{
System.out.println(linecopy + " is not a multiple of 9.");
}
line=in.readLine();
}
}catch(Exception ex){}

}
}