We use cookies to collect and analyze information on site performance and usage,
to provide social media features and to enhance and customize content and advertisements.
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 :-)
}
}