Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class EndingInput2 {
- public static void main(String[] args) {
- Scanner kb = new Scanner(System.in);
- System.out.println("Enter the size of your array");
- int size = kb.nextInt();
- int[] nums = new int[size];
- int i=0;
- while(temp>=0){
- System.out.println("enter your numbers or -1 to quit");
- int temp = kb.nextInt();
- if(temp >=0){
- nums[i]=temp;
- i++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement