#include <stdio.h>
/*
CONVERSIONE IN BASE B
Algoritmo in pseudocodice
Input di N;
Mentre N > 0:
esegui divisione intera: N = P·B + R con 0 ≤ R < B;
stampa R (una cifra in base B) ;
poni N = P;
*/
int main() {
int N, P, R, B;
B = 8;
scanf("%d",&N); // input di N
while( N>0 ) {
P = N / B; // risultato
R = N % B; // resto
printf("c=%d\n",R); // output resto => cifra in base B
N = P;
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: