Untitled

 avatar
unknown
c_cpp
4 years ago
493 B
5
Indexable
#include  <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;



int N = 10;

int nod[N + 5];
// generate nod for all numbers from 1 to N

 for (int i = 1; i <= N; i++) {
        cout << i << endl;
        for (int j = i; j <= N; j += i) {
            cout << j << endl;
            nod[j] ++;
        }
    }
    for (int i = 1; i <= 10; i++) {
        cout << i << " " << nod[i] << "\n";
    }

}
Editor is loading...