Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SumOfChars_04 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int countSymbols = Integer.parseInt(scanner.nextLine());
- //1. прочитаме символ
- //2. сумираме
- int sum = 0;
- for (int i = 1; i <= countSymbols ; i++) {
- char symbol = scanner.nextLine().charAt(0);
- sum += (int)symbol;
- }
- System.out.println("The sum equals: " + sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement