Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /*
  4.  * Justin Herrera
  5.  * COSC 1336
  6.  * pp 5.
  7.  *
  8.  */
  9.  
  10. public class CharPerLine {
  11.  
  12.    
  13.     public static void main(String[] args) {
  14.        
  15.         int length;
  16.        
  17.         System.out.println("Enter a sentence");
  18.        
  19.         Scanner scan = new Scanner ( System.in );
  20.        
  21.         String choice = scan.nextLine();
  22.        
  23.         System.out.println(choice.charAt(1));
  24.        
  25.         length = choice.length();
  26.         // initialize // condition // update
  27.         for (int count=0; count < length; count++) {
  28.            
  29.         System.out.println(choice.charAt(count));
  30.         }
  31.  
  32.     }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement