# Program to print Square Number series 1 4 9 16...N

## Problem statement:- Program to Print Square Number series 1 4 9 16...N.

Data requirement:-

Input Data:- n

Output Data:-i

Program in C

## Here is the source code of the C Program to Print Square Number series 1 4 9 16...N.

Code:

``#include <stdio.h>int main(){    int n, i = 1;    printf("Enter the range of number(Limit):");    scanf("%d", &n);    while (i <= n)    {        printf("%d ", i * i);        i++;    }}``

Input/Output:
Enter the range of number(Limit):4
1 4 9 16

Program in C++

## Here is the source code of the C++ Program to Print Square Number series 1 4 9 16...N.

Code:

``#include <iostream>using namespace std;int main(){    int n, i = 1;    cout << "Enter the range of number(Limit):";    cin >> n;    while (i <= n)    {        cout << i * i << " ";        i++;    }}``
Input/Output:
Enter the range of number(Limit):6
1 4 9 16 25 36

Program in Java

## Here is the source code of the Java Program to Print Square Number series 1 4 9 16...N.

Code:

``import java.util.Scanner;public class p8 {    public static void main(String[] args) {        Scanner cs = new Scanner(System.in);        int n, i = 1;        System.out.println("Enter the range of number(Limit):");        n = cs.nextInt();        while (i <= n) {            System.out.print(i * i + " ");            i++;        }        cs.close();    }}``

Input/Output:
Enter the range of number(Limit):
10
1 4 9 16 25 36 49 64 81 100

Program in Python

## Here is the source code of the Python Program to Print Square Number series 1 4 9 16...N.

Code:

``n = int(input("Enter the range of number(Limit):"))i = 1while(i <= n):    print(i*i, end=" ")    i += 1``

Input/Output:
Enter the range of number(Limit):
3
1 4 9