Sunday, 19 July 2009

This program is designed to find out the super square of an integer.

import javax.swing.JOptionPane;
public class SuperSquare1{
public static void main(String args[]){
String Input =
JOptionPane.showInputDialog("Please enter the integer");
int Number = Integer.parseInt (Input);
if (Number == 0){
System.out.println("You have entered 0, so the super square is 0");
}
else {
long SuperSquare = (long) Math.pow(Number, Number);
System.out.println("The Super Square is " + SuperSquare);
}
}
}

No comments:

Post a Comment