Computer Science, asked by sankhasuvrodutta63, 1 year ago

write a program in java to print this following pattern 1 11 111 1111 11111​

Attachments:

Asna123: It is series not pattern

Answers

Answered by lucifer1912
3
Sopln-System.out.println
Attachments:
Answered by jithinayalloor
8

Answer:

import java .util.*;

class num1111111

{

    public static void main()

     {

         Scanner sc= new Scanner(System.in);

         System.out.print('\u000C');

         System.out.println("Program to print 1,11,111,1111,11111......upto n terms");

         System.out.println("Enter the number of terms");

         int n = sc.nextInt();

         long tv = 0;

         System.out.println("The series is: ");

         for(int tn=1;tn<=n;tn=tn+1)

         {

             

             tv = tv*10+1;

             System.out.println(tv+" ");

             

             

           }

       }

   }

Explanation:

Similar questions