Hi all.. I m a begginer in java... i want to write a series like 1 to the power 2, 2 to the power 3 as so on... i can print its value only line 1 , 8 , 81...
but i cant write the series where all to the power number will be in superscript order... pls can anyone help me?? here is my code where i found only the values of 1 to the power2 , 2 to the power 3....

import java.io.*;
class srs3
{
    public static void main(String args[])throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int i,n,m;
        System.out.println("Enter the range:-");
        n=Integer.parseInt(br.readLine());
        System.out.println();
        System.out.println("The series upto "+n+" is: "); 
        System.out.println();       
        for(i=1;i<=n;i++)
        {
            int s=(int) Math.pow(i,(i+1));
            System.out.print(s+" ");

        }
    }
}

thanks in advance.... :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.