Advertisement
desislava_topuzakova

01. Read Text

May 16th, 2020
1,739
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 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.         //повтаряме: четене на текст
  7.         //стоп: текст == "Stop"
  8.         //продължаваме: текст != "Stop"
  9.         String text = scanner.nextLine();
  10.         int count = 0;
  11.  
  12.         while(!text.equals("Stop")){
  13.             text = scanner.nextLine();
  14.             count++;
  15.         }
  16.  
  17.         System.out.println(count);
  18.  
  19.  
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement