63 041
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #16971 in Action Script | Flash | Flex | ColdFusion for analiza moradas

Question #16971
create a java program that accepts input numbers and continues to do so until a negative entered. It will then display the positive output.
Expert's answer
import java.util.Scanner;




class MyProg{



public static void main(String[] args){




Scanner input = new Scanner(System.in);

int[] arr = new int[100];




int n=0, count=0;

do{

System.out.print("Enter number: ");

n = input.nextInt();

if(n>=0){

arr[count] = n;

count++;

}

}while(n >= 0);

for(int i=0;i<count;i++)

System.out.println(arr[i]);

}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions