Please login

Prime

Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

Wipro NLTH Pattern Making Questions

Ques. Programming Pattern to Print 2*N Number of rows for input Pattern?

3
44
555
6666
555
44
3

 

#include 
using namespace std;
int main()
{
int n=4,num=n-1;

for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
cout<<num;
num++;
cout<<endl;
}
num--;

for(int i=n;i>=1;i--)
{
for(int j=1;j<=i;j++)
cout<<num;
num--;
cout<<endl;
}
return 0;
}
#include 
using namespace std;
int main()
{
int n=4,num=n-1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
cout<<num;
num++;
cout<<endl; } num–; for(int i=n;i>=1;i–)
{
for(int j=1;j<=i;j++)
cout<<num;
num–;
cout<<endl;
}
return 0;
}
public class Pattern {

public static void main(String[] args) {

int N=4;
for(int i=1;i<=N;i++) {
for(int j=1;j<=i;j++) System.out.print(i+2); System.out.println(); } for(int i=N-1;i>=1;i–) {
for(int k=1;k<=i;k++) System.out.print(i+2);

System.out.println();
}
}

}

Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.

One comment on “Wipro NLTH Pattern Making Questions”


  • Alok

    #include
    using namespace std;

    int main() {
    int n;
    cin>>n;
    int m=n;

    for(int i=0; i<n+1; i++)
    {
    for(int j=0; j<=i; j++)
    cout<<m;
    m++;
    cout<=0; i–)
    {
    m–;
    for(int j=0; j<=i; j++)
    cout<<m;
    cout<<endl;
    }
    return 0;
    }