Counting letters in a string using two for-loops

后端 未结 4 416
臣服心动
臣服心动 2021-01-17 04:45

I have to read the string \"hello world\" and output each letter\'s frequency using only for loops. The instructor hinted that I\'d need to use two loops and ga

4条回答
  •  野的像风
    2021-01-17 05:23

    int count;
    int value;
       for (int i=65; i<91; i++) {
          count=0;
          for (int j=0; j0) 
          System.out.println((char)i+" -- "+count);
    }
    

提交回复
热议问题