HarrJ

Day 9

Aug 9th, 2023
968
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. package mng2023b5;
  2. import java.util.Scanner;
  3.  
  4. public class Day09B {
  5.     public static void main(String[] args) {
  6.         Scanner sc = new Scanner(System.in);
  7.         int count = 0;
  8.         String txtIn="", txtResult="";
  9.        
  10.         while (count < 7) {
  11.             System.out.println(count);
  12.            
  13.             count++;
  14.         }
  15.        
  16.         // all the loop need is a condition
  17.         // if you have a way to trigger it like in
  18.         //     an if else statement then you can use it
  19.         System.out.println("enter words(type x to end:");
  20.         while (txtIn.equalsIgnoreCase("x") == false) { // kelangan reverse condition
  21.             txtIn = sc.nextLine();
  22.            
  23.             txtResult += txtIn + " ";
  24.         }
  25.         System.out.println(txtResult.toUpperCase());
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment