Răspuns:
Explicație:
#include <iostream>
using namespace std;
int n,k,i,j,m,r;
int main()
{
cout << "n="; cin >> n;
cout << "k="; cin >> k;
m=n/k; r=n%k;
for (i=1; i<=m; ++i)
{
for (j=1; j<=k; ++j)
cout << j << " ";
}
for (j=1; j<=r; ++j)
cout << j << " ";
}