Computer Science, asked by saradavenkat, 5 months ago

print this pattern(write a program
1
12
123
1234
12345

Answers

Answered by krishnas10
2

Answer:

code in c++

Explanation:

#include<bits/stdc++.h>

using namespace std;

int main ()

{

int i,j;

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

{

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

{

cout<<j;

}

cout<<endl;

}

}

Answered by atrs7391
1

Easiest program:

package com.company;  

public class Main {

  public static void main(String[] args) {

      int s = 0;

      for (int i = 1; i <= 5 ; i++) {

          s = s*10+i;

          System.out.println(s);

      }

  }

}

Output:

1

12

123

1234

12345

Similar questions