Computer Science, asked by amartyasrimani1264, 10 months ago

Patternu IV
Write a program to print the given below pattern.
Sample Input:
5
Sample Output:
11112
32222
33334
54444
55556
Case 1
Case 2
Case 3
Input (stdin)
5
Output (stdout)
11112
32222
33334
54444
55556

Answers

Answered by ANUPRAVACHAKRABORTI
0

4567890589 is the Answer

Answered by AirSniper
0

Answer:

#include<bits/stdc++.h>

using namespace std;

int main()

{

 int m;

 cin>>m;

 for(int i = 1 ; i<=m;i++)

 {

   if(i%2 == 1)

   {

   for(int j=0;j<m-1;j++)

   {

     cout<<i;

   }

     cout<<i+1;

      cout<<"\n";

   }

  else

  {

    cout<<i+1;

    for(int j=0;j<m-1;j++)

   {

     cout<<i;

   }

      cout<<"\n";

  }

   }

 }  

Explanation:

All tests passed

Similar questions