Print123 [] (https://www.codechef.com/PATN2021/problems/PRIN6666)

Practice

Author: Aryan KD
Tester: Aryan KD
Editorialist: Aryan KD

DIFFICULTY:

CAKEWALK, SIMPLE, EASY.

PREREQUISITES:

Math .

PROBLEM:

Abhi is vary good in Art . he also won a gold medal in his art . now his dad give him a task to print a some stars and numbers in it . his dad give him a number MM and he has to print pattern according to given number. it is not a hard task for Abhi but now he is busy so you have to print a pattern like it.
here N=4

4321
 ***
 21
 *



# QUICK EXPLANATION:
you have just print the following pattern 

# EXPLANATION:
for given number of N you have just print the following pattern 
for example N=4
4321
 ***
 21
 *
# SOLUTIONS:

[details="Setter's Solution"]
#include<bits/stdc++.h>
using namespace std;
void testcase()
{
  int n;
    cin>>n;
   for(int i=1;i<=n;i++)
    {
        int k;
        k=n;
       for(int i=n;i>=1;i--)
        {
            cout<<i;
        }
        cout<<endl;
        for(int i=0;i<(n-1);i++)
        {
            cout<<"*";
        }
        cout<<endl;
        n=n-2;
    }
    cout<<"1";
}
int main()
{
int t;
cin>>t;
while(t--)
{
testcase();
cout<<endl;
}
return 0;
}
[/details]

[details="Tester's Solution"]
#include<bits/stdc++.h>
using namespace std;
void testcase()
{
  int n;
    cin>>n;
   for(int i=1;i<=n;i++)
    {
        int k;
        k=n;
       for(int i=n;i>=1;i--)
        {
            cout<<i;
        }
        cout<<endl;
        for(int i=0;i<(n-1);i++)
        {
            cout<<"*";
        }
        cout<<endl;
        n=n-2;
    }
    cout<<"1";
}
int main()
{
int t;
cin>>t;
while(t--)
{
testcase();
cout<<endl;
}
return 0;
}
[/details]

[details="Editorialist's Solution"]
#include<bits/stdc++.h>
using namespace std;
void testcase()
{
  int n;
    cin>>n;
   for(int i=1;i<=n;i++)
    {
        int k;
        k=n;
       for(int i=n;i>=1;i--)
        {
            cout<<i;
        }
        cout<<endl;
        for(int i=0;i<(n-1);i++)
        {
            cout<<"*";
        }
        cout<<endl;
        n=n-2;
    }
    cout<<"1";
}
int main()
{
int t;
cin>>t;
while(t--)
{
testcase();
cout<<endl;
}
return 0;
}
[/details]