Print Square

The program must accept a number and print it’s square.

Example Input/Output 1:
Input:
5

Output:
25

Example Input/Output 2:
Input:
9

Output:
81

Python

N = int(input())
print(N*N) 

Java

import java.util.*;
public class Hello {
    public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
System.out.print(N*N);
}
}

C

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int X;
    scanf("%d", &X);
    printf("%d", X * X);
}

C++

#include <iostream>
using namespace std;
int main()
{
    int N;
    cin >> N;
    cout << N*N;
    return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

More posts. You may also be interested in.