Dremendo Tag Line

Print the number series 1 4 9 using for loop in C++

for Loop - Question 4

In this question, we will see how to print the number series 1 4 9... in C++ programming using for loop. To know more about for loop click on the for loop lesson.

Q4) Write a program in C++ to print the number series given below using for loop.

1 4 9 16 25 36 49 64 81 100

Program

#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
    int i;

    for(i=1; i<=10; i=i+1)
    {
        cout<<i*i<<" ";
    }
    return 0;
}

Output

1 4 9 16 25 36 49 64 81 100
video-poster