Advertisement
yanivtamari

29.05(2)

May 29th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner s = new Scanner(System.in);
  7.         char[] arr = new char[10];
  8.         System.out.printf("please enter %s letters ", arr.length);
  9.         for (char i = 0; i < arr.length; i += 1)
  10.             arr[i] = s.next().charAt(0);
  11.         System.out.printf("The Capital Letters is in index: ");
  12.         for (int i = 0; i < arr.length; i += 1) {
  13.             if (arr[i] >= 'A' && arr[i] <='Z')
  14.                 System.out.printf("%d ",i);
  15.         }
  16.  
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement