Friday, August 16, 2013

Exercise no. 14

import javax.swing.JOptionPane;
public class Exercise14 {
  
    public static void main(String [] args)
    {
  
    String squares;
  
    squares=JOptionPane.showInputDialog(null,"Enter the number");
  
    int s=Integer.parseInt(squares);
  
    int a=0,x=0;
    for ( ;x<=s;x++)
    {  
        Math.pow(x,2);
      
    }
    JOptionPane.showMessageDialog(null,"The sum of Square  is : " + Math.pow(x,2));
}
}

No comments:

Post a Comment