CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
using namespace std;
//using addtion
int main() {
int z;
cin >> z;
int x = z-1;
int out[x+2];
int temp[x+2];
int c = 0;
int a;
int b;
temp[0] = 0;
temp[1] = 1;
for(int i = 2; i < x+2; i++)
temp[i] = 0;
do{
for(int i = 0; i < c+2; i++){
a = temp[i];
b = temp[i+1];
out[i +1] = a+b;
if(i<c+1)
cout << out[i+1] << " ";
}
cout << endl;
for(int i = 0; i < c+1; i++){
a = out[i+1];
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run