Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package javaapplication8;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11. *
  12. * @author thecl
  13. */
  14. public class IntArray {
  15. public static void main1(String[] args) {
  16. Scanner in = new Scanner(System.in);
  17. System.out.println("enter a quantity of nums");
  18.  
  19. int len = (int) in.nextDouble();
  20. System.out.println("enter nums");
  21. double[] kek = new double[len];
  22.  
  23. int j = 0;
  24. while(j<len){
  25. kek[j] = in.nextDouble();
  26. j++;
  27. }
  28.  
  29. System.out.println();
  30.  
  31. j = 0;
  32. do{
  33. System.out.print(kek[j] + " ");
  34. j++;
  35. }while(j<len);
  36.  
  37.  
  38. System.out.println();
  39.  
  40. for(int i =0;i<len;i++){
  41. if(kek[i]==(int)kek[i]){
  42. System.out.print((int)kek[i] + " ");
  43. }
  44. }
  45.  
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement