Program to generates and find thw sum of the series, 4+12+36+108+……..

class test
{ public static void main(String[] asd)throws IOException
BufferedReader obj= new BufferedReader(new InputStreamReader(;
int n,sum=1,result=0;
String num;

System.out.print("Enter a number:: ");
for(int i=0;i<n;i++)
{   sum=1;
for(int j=0; j<i;j++)

result+= 4*sum;
System.out.print((4*sum)+" ");
System.out.println("Sum of the series is="+result+".");

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s