Answers for "Write a program to print first ten natural numbers in java"

0

Write a program to print first ten natural numbers in java

public class Main
{
public static void main(String[] args)
{
int number = 10, sum = 0;
for(int i = 1; i <= number; ++i)
{
sum =sum + i;
}
System.out.println("Sum = " + sum);
}
}
Posted by: Guest on June-12-2021

Code answers related to "Write a program to print first ten natural numbers in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language