Computer Science, asked by botrerutu8811, 4 months ago

Sara and pattern
Sara loves patterris, today she
encounters an interesting pattern
and wants to write a code that can
print the pattern of a given height N.
As Sara is weak in programming
help her to code it.
The pattern for height 6:-
0 4 8 12 16 20
6 10 14 18 22 26
12 16 20 24 28 32
18 22 26 30 34 38
24 28 32 36 40 44
30 34 38 42 46 50
Edit​

Answers

Answered by piyush4965
19

Answer:

............... m.........

Answered by dreamrob
5

Program :

#include<iostream>

using namespace std;

int main()

{

int N;

cout<<"Enter the height of the pattern : ";

cin>>N;

for(int i = 0 ; i < N ; i++)

{

 int t = i * 6;

 for(int j = 0 ; j < N ; j++)

 {

  int k = j*4;

  cout<<t + k<<" ";

   

 }

 cout<<endl;

}

return 0;

}

Output :

For N = 6

0 4 8 12 16 20

6 10 14 18 22 26

12 16 20 24 28 32

18 22 26 30 34 38

24 28 32 36 40 44

30 34 38 42 46 50

Attachments:
Similar questions