Advertisement
yanivtamari

29.05(3)

May 29th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 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.         int[] arr = new int[10];
  8.         System.out.printf("please enter %d numbers ", arr.length);
  9.         for (int i = 0; i < arr.length; i += 1)
  10.             arr[i] = s.nextInt();
  11.         System.out.printf("The Answer is: ");
  12.         for (int i=0; i <arr.length; i += 1) {
  13.             if (arr[i]%3==0)
  14.                 System.out.printf("%d ",arr[i]);
  15.         }
  16.  
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement