Editorial
Use a for or while loop to print the squares of numbers not exceeding .
Algorithm realization
Read the input value of .
scanf("%d",&n);
In the variable iterate through the numbers until is less than or equal to . Sequentially print the squares of positive integers on a single line.
i = 1; while(i * i <= n) { printf("%d ",i * i); i++; } printf("\n");
Algorithm realization — for loop
Read the input value of .
scanf("%d",&n);
In the variable iterate through the numbers until is less than or equal to . Sequentially print the squares of positive integers on a single line.
for(i = 1; i * i <= n; i++) printf("%d ",i * i); printf("\n");
Python realization
Read the input value of .
n = int(input())
In the variable iterate through the numbers until is less than or equal to . Sequentially print the squares of positive integers on a single line.
i = 1 while i * i <= n: print(i * i, end=" ") i += 1