Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

JAVA Display numbers from 1 to 5

// Program to print numbers from 1 to 5

class Main {
  public static void main(String[] args) {
  
    int n = 5;
    // for loop  
    for (int i = 1; i <= n; ++i) {
      System.out.println(i);
    }
  }
}
 
PREVIOUS NEXT
Tagged: #JAVA #Display #numbers
ADD COMMENT
Topic
Name
8+9 =