35 lines
466 B
C++
Raw Normal View History

2025-01-29 10:41:31 +01:00
#include <iostream>
#include <conio.h>
using namespace std;
int main() {
int n,i,k;
cout << "N = ";
cin >> n;
int *a = new int[n];
cout << "K = ";
cin >> k;
int j = 0;
i = k*2;
while (i<=n){
i++;
if(i%k == 0) {
a[j] = i;
j++;
}
}
i = 0;
while(i<j) {
cout << a[i] << " ";
i++;
}
delete [] a;
system("pause");
getch();
return 0;
}