SHARE
TWEET

Untitled

a guest Mar 26th, 2020 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public static void malaDuza(){
  2.         System.out.println("Podaj tekst do przetworzenia...");
  3.         Scanner scanner = new Scanner(System.in);
  4.         String inputText = scanner.nextLine();
  5.         String result = "";
  6.  
  7.         char[] tabOfChars = inputText.toCharArray();
  8.         for (int i =0; i < tabOfChars.length; i++) {
  9.             if(i % 2 == 0){
  10.                 result = result + String.valueOf(tabOfChars[i]).toUpperCase();
  11.             }else{
  12.                 result = result + String.valueOf(tabOfChars[i]);
  13.             }
  14.         }
  15.  
  16.         System.out.println("Zmodyfikowany tekst: "+ result);
  17.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top