Computer Science, asked by aayushiverma, 1 year ago

write a program in java to display the series....


1,11,111,1111 _______________ n terms​

Answers

Answered by 2bcasankar
3

Answer:

print 1, (1*10+1),(1*10*10+1),,,.

Explanation:

Scanner in =new Scanner(Saytem.in);

int i=1,j=10,n,num=i;

n=in.nextInt();

for(int k=0<n;k++)

{

System.out.println(num);

num=(i*j+1);

}

Answered by Styengun
7

Answer:

class series

{

public static void main(string args[ ] )

{

int i,s=0,t=0;

for(i =1;i<= n;i++)

{

s=s*10+1;

t=t+s;

}

System.out.println(t);

}

}

Explanation:

1st term=0*10+1=1

2nd term=1*10+1=11

.

.

.

so it continues.

The loop runs from 1 to n to take out the terms.

Similar questions