Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int number,i,x;
- char tab[99];
- int main()
- {
- for(;;)
- {
- printf("Podaj liczbe naturalna w zapisie 10: "); scanf("%d",&number);
- printf("Wybierz system od 2 do 36 na ktory chcesz zamienic ta liczbe: "); scanf("%d",&x);
- if((x>1)&&(x<37))
- {
- printf("Liczba %d",number);
- for(i=0;number>=1;i++)
- { tab[i]=number%x;
- if(tab[i]<10)
- tab[i]+=48;
- else
- tab[i]+=55; //65-A 90-Z 25+10=35+1
- number/=x;
- }
- printf(" w systemie %d-owym jest rowna: ",x);
- for(i=i-1;i>=0;i--)
- printf("%c",tab[i]);
- printf("\n");
- }
- else printf("Podana liczba nie nalezy do przedzialu !");
- getchar();getchar();
- system("cls");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement