MCPcopy Create free account
hub / github.com/Hazrat-Ali9/Computer-Programming / main

Method main

Problem4.java:5–32  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

3public class Problem4 {
4
5 public static void main(String[] args) {
6 // TODO Auto-generated method stub
7 Scanner scan = new Scanner(System.in);
8 int[] sum;
9 int N;
10 char[] wordInArray;
11
12 N = scan.nextInt();
13 scan.nextLine();
14 sum = new int[N];
15
16 for (int i = 0; i < N; i++) {
17 int individualSum = 0;
18 wordInArray = scan.nextLine().toCharArray();
19
20 for (char c : wordInArray) {
21 individualSum = individualSum + (int) c;
22 }
23
24 sum[i] = individualSum;
25 }
26 scan.close();
27
28 for (int i = 0; i < sum.length; i++) {
29 System.out.printf("%d\n", sum[i]);
30 }
31
32 }
33
34}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected