| Real'sHowTo |
|
|
Custom Search
|
| Real'sHowTo |
|
|
Custom Search
|
public class Gates {
static String beast = "BillGates";
public static void main(String args[]) {
char [] temp = beast.toUpperCase().toCharArray();
int j = temp.length;
int i = 0;
int k = 0;
while (i < j) {
k += temp[i++];
System.out.println(temp[i-1]);
}
// Since it's really "Bill Gates III"
System.out.println(k + 1 + 1 + 1);
// output : 666 :-)
}
}
Written and compiled by Réal Gagnon ©1998-2013
[ home ]