Computer Science, asked by khanmahera880, 1 month ago

Write a program in Java to find the square of a given number.
.5
5*5​

Answers

Answered by Anonymous
5

The códe:

import java.util.*;

class x{

public static void main(String s[]) {

Scanner sc=new Scanner(System.in);

System.out.print("Enter a number: ");

int n=sc.nextInt();

System.out.println("Square: "+n*n);

sc.close();

}

}

Logic:

  • Just accept the number and multiply it by itself and display it.
Similar questions