Popular Posts

Thursday, December 9, 2010

X to the Power Y

class Power
{
    public static void main(String args[])
    {
        int n1,n2,i,power=1;
        n1=(int)(Math.random()*10);
        n2=(int)(Math.random()*10);
       
        System.out.println("First generated no. is="+n1);
        System.out.println("Second generated no. is="+n2);
       
        for(i=1;i<n2;n2++)
        {
            power*=n1;
            System.out.println("Power of number is:"+power);
        }
           
    }
}

No comments:

Post a Comment