import java.io.*;
import java.lang.Math;
class nsumfact
{
public static void main (String args[]) throws IOException
{
int j, sum=0, i, n;
InputStreamReader ir=new InputStreamReader(System.in);
BufferedReader br =new BufferedReader(ir);
System.out.println("Please Enter the value of N");
n=Integer.parseInt(br.readLine());
System.out.println("");
for(i=1;i<=n;i++)
{
System.out.print("(");
for(j=1;j<=i;j++)
{
if(j==1)
{
System.out.print(+j);
}
else if(j>i)
{
System.out.print(+j);
}
else
{
System.out.print(" + "+j);
}
}
System.out.print(")");
if(i==n)
{
System.out.print(".");
}
else
{
System.out.print("+");
}
}
}
}
No comments:
Post a Comment