/* Something is wrong here not exactly sure i am a beginner. I cannot use ANY classes.
EXAMPLE: if argument value is "ABC" then the return value should be "198".
Help! Thanks in advance*/
public class Test {
public static void main(String[] args) {
addChars("ABC");
}
public static int addChars ( String s ) {
int sum = 0;
for (int i=0; i<s.length();i++) {
if(s.charAt(i) <= s.length()) {
sum += (int)s.charAt(i); // adds Unicode value to sum
}
else {
return 0;
}
}
return sum;
}
}