Розбір
Print the numbers from to using a loop.
Algorithm realization
Read the input value of .
scanf("%d",&n);
Print the numbers from to in a single line, separated by spaces.
for(i = 1; i <= n; i++) printf("%d ",i);
Terminate the line with a newline character.
printf("\n");
Java realization
import java.util.*; class Main { public static void main(String[] args) { Scanner con = new Scanner(System.in); int n = con.nextInt(); for(int i = 1; i <= n; i++) System.out.print(i + " "); con.close(); } }
Python realization
Read the input value of .
n = int(input())
Print the numbers from to in a single line, separated by spaces.
for i in range(1,n+1): print(i, end = " ")