Advertisement
desislava_topuzakova

05. Character Sequence

May 9th, 2020
1,353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class demo {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         String text = scanner.nextLine();
  7.  
  8.         //за всяка една позиция от стринга 0 до последната
  9.         //взимаме символа на тази позиция; печатаме символа
  10.         //отиваме на следващата позиция
  11.         for (int position = 0; position <= text.length() - 1 ; position++) {
  12.                 char symbol = text.charAt(position);
  13.                  System.out.println(symbol);
  14.         }
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement