Created
April 19, 2010 18:52
-
-
Save rpt/371435 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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