write a java program to print the following series 1,2,3........n
Answers
Answered by
3
Question:-
Write a java program to print the series.
1 2 3 4 ....N
Program:-
import java.util.*;
class Series
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter the number of terms for the series: ");
int n=sc.nextInt();
for(int i=1;i<=n;i++)
System.out.print(i+" ");
}
}
Similar questions