40 lines
574 B
C++
40 lines
574 B
C++
#include <iostream>
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int i,k,n,m;
|
|
|
|
cout << "Podaj liczbe dziesietna: ";
|
|
cin >> n;
|
|
int *a = new int[n];
|
|
|
|
m=n;
|
|
|
|
i = 1;
|
|
while(m>=1) {
|
|
a[i] = m % 8;
|
|
cout << a[i] << " ";
|
|
m = m / 8;
|
|
i++;
|
|
}
|
|
|
|
k = i - 1;
|
|
|
|
cout << endl << "K = " << k << endl;
|
|
|
|
for(i = 1; i <= k; i++) {
|
|
if(i % 3 == 0) {
|
|
cout << " " << a[i];
|
|
}
|
|
else {
|
|
cout << a[i];
|
|
}
|
|
}
|
|
|
|
cout << endl;
|
|
|
|
delete [] a;
|
|
|
|
system("pause");
|
|
return 0;
|
|
} |