Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
- #include <conio.h>
- int main ()
- {
- int F, T , i ,N, S, j;
- char K[100], ch;
- double S1;
- printf("Âèáåð³òü ñèñòåìó ÷èñëåííÿ : ");
- scanf("%d", &F);
- printf("Âèáåð³òü ñèñòåìó ÷èñëåííÿ äëÿ : ");
- scanf("%d", &T);
- if ((F>0) && (F<=36) || ((T>0) && (T<=36)))
- {
- printf("Ââåä³òü ÷èñëî: ");
- fflush(stdin);
- fgets(K,100,stdin);
- strupr(K);
- j=0;
- S1=0;
- for (i=strlen(K)-2; i>=0; i--,j++)
- {
- ch=K[i];
- if (('a' <= ch && ch >= 'z') || ('A'<= ch && ch <= 'z')) N=(K[i]-55);
- else N=(K[i]-48);
- printf("%d\n", N);
- S1+=double(N)*(double)pow(F,j);
- if (N >= F) return -2;
- }
- printf(" 10-òè÷íó : %.01f\n", S1);
- S=int(S1);
- itoa(S,K,T);
- printf("\n  %d-òè÷íó : %s", T, K);
- getch();
- }
- else return -2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement