Skip to content

Instantly share code, notes, and snippets.

@rpt
Created April 19, 2010 18:52
Show Gist options
  • Save rpt/371435 to your computer and use it in GitHub Desktop.
Save rpt/371435 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main() {
const char znaki[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
int pokonw[64];
long int dokonw;
int podstawa, i=0, nast;
printf("Liczba dziesiatkowa do konwersji: ");
scanf("%ld", &dokonw);
printf("Podstawa liczby wyjsciowej: ");
scanf("%i", &podstawa);
do {
pokonw[i]=dokonw%podstawa;
i++;
dokonw=dokonw/podstawa;
}
while (dokonw!=0);
printf("Przeksztalcona liczba = ");
for (--i; i>=0; --i) {
nast=pokonw[i];
printf("%c", znaki[nast]);
}
printf("\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment