Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. public class even
  2. {
  3. public static void main(String[] args) {
  4.  
  5. System.out.println("Enter a limit ");
  6. int limit=Integer.parseInt(System.console().readLine());
  7.  
  8. System.out.println("Printing Even numbers between 1 and " + limit);
  9.  
  10. for(int i=1; i <= limit; i++){
  11.  
  12. if( i % 2 == 0){
  13. System.out.print(i + " ");
  14. }
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement