Computer Science, asked by a9456, 1 month ago

Sample Input
5
Sample Output o
01 02 03 04 05 26 27 28 29 30
__06 07 08 09 22 23 24 25
______10 11 12 19 20 21
________13 14 17 18
__________15 16

This is a Pattern program So Try accordingly​, that line indicates a space​

Answers

Answered by gimmelike
1

Answer:

0/10

Write a program to print the following pattern for the

given N (total number of rows).

Pattern for N=6

0/10

*1*2*3

*4*5*

0/10

*6*7

*8*

*9

10.0/10

EN

10.0/10

Input Format:

0/10

The only input line contains the value of N (Total

no. of rows)

0/40

Output Format:

Pattern in N lines

aber

0140

Explanation:

Sample Input

5

Sample Output o

01 02 03 04 05 26 27 28 29 30

__06 07 08 09 22 23 24 25

______10 11 12 19 20 21

________13 14 17 18

__________15 16

pls markbranilest

Answered by dreamrob
1

Program in C++:

#include<iostream>

using namespace std;

int main()

{

int n;

cout<<"Enter a number : ";

cin>>n;

int count = 1;

int e_l = n * (n - 1) / 2;

int e_u = (n * n) - e_l;

int total = e_u * 2;

int n1 = n;

for(int i = n; i >= 1; i--)

{

 for(int k = 1; k <= n-i; k++)

 {

  cout<<"   ";

 }

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

 {

  if(count <= 9)

  {

   cout<<"0"<<count<<" ";

  }

  else

  {

   cout<<count<<" ";

  }

  count++;

 }

 int start = total-n1;

 for(int l = start + 1; l <= total; l++)

 {

  if(l <= 9)

  {

   cout<<"0"<<l<<" ";

  }

  else

  {

   cout<<l<<" ";

  }

 }

 total = start;

 n1--;

 cout<<endl;

}

}

Attachments:
Similar questions