write a program to print square of number 1 to 10 using for loop
Answers
Heya!
Since you have not mentioned any specific language, I'm giving you the basic idea of the program....
Here we go...........
//start of program......
FOR I = 1 TO 10
INT J = I
PRINT (I * J)
J++
NEXT
//end of program.......
Answer: - The program to print the square of the numbers using the loop is written below.
Detailed answer: -
The program: -
The C program written below is the program that accepts the user input and prints the square of number from 1 till that number you put last.
#include <stdio.h>
int main(void) {
int i, N;
printf("Enter N : ");
scanf("%d",&N);
for(i=1;i<=N;i++)
{
printf("%d ",i*i);
}
return 0;
}
The output will be, if the N is 10 then: -
1, 4, 9, 16, 25, 36, 49, 64, 81, 100
The output will be the square of the numbers 1 to 10 if you give the value of N equal to 10.
C programming language: -
- The C programming language is a general-purpose computer language used for programming.
- The C programming language is a successor of the B programming language which was introduced around 1970.
- The C programming language was formed in 1988 by the American National Standard Institute which is named in short as ANSI.
To know more about the topic, go to the below links: -
https://brainly.in/question/44064868
https://brainly.in/question/30367763
#SPJ3