//Program to print range of N numbers using Stream in Java import java.util.*; import java.util.stream.*; public class Hello { public static void main(String[] args) { Scanner s=new Scanner(System.in); int N=s.nextInt(); // Input from user IntStream.range(1,N+1).forEach(n->{System.out.print(n+" "); } ); } }


Others
VISHAL PERIYASAMY R
2 11 1402
4 months ago

//Program to print range of N numbers using Stream in Java
import java.util.*;
import java.util.stream.*;
public class Hello {

    public static void main(String[] args) 
	 {
	     Scanner s=new Scanner(System.in);
	     int N=s.nextInt(); // Input from user 
	     IntStream.range(1,N+1).forEach(n->{System.out.print(n+" "); } );

	}
}