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

Answer to Question #3523 in Java | JSP | JSF for Y mukundareddy

Question #3523
4) Write a program to print n umbers and enter a number where you want to break the program
Expert's answer
import java.util.Scanner;




public class Main {




public static void main(String[] args) {




int n;

Scanner in = new Scanner(System.in);

System.out.print("Enter a number where you want to break the program: ");

n = in.nextInt();

if(n > 0){

for(int i = 1; i < n+1; i++){

System.out.println(i);

}

}

else

System.out.println("ERROR");

}




}

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