Find Square Of Number In Java


In this core java programming tutorial we will write a basic program to find Square Of Number In Java.





Full Program/SourceCode / Example to Find Square Of Number In Java >
import java.util.Scanner;
/*
* Write a program to Find Square Of Number In Java
*/
public class SquareOfNumberInJava {
   public static void main(String[] args) {
  
          Scanner scanner = new Scanner(System.in);
          System.out.println("Enter number : ");
          int number = scanner.nextInt();
          System.out.println("square of "+number+" = " + (number * number));
         
   }
}
/*OUTPUT
Enter number :
4
square of 4 = 16
*/



So, in this core java programming tutorial we wrote a program to Find Square Of Number In Java..


Having any doubt? or you you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.



RELATED LINKS>

Write a program to add two numbers in java

Write a program to Subtract two numbers in java

Multiply two numbers in java

program to Divide two numbers in java



>Pattern/Pyramid generating programs



Must read for you :

No comments:

Post a Comment