Long time no see

This commit is contained in:
2026-02-21 10:47:00 +07:00
parent 0d54fe176e
commit b7df98a55c
198 changed files with 3249 additions and 1 deletions
+28
View File
@@ -0,0 +1,28 @@
#include <stdio.h>
void to_base_n(unsigned long *n, int *b);
int main(void){
unsigned long num;
int bin;
printf("Enter: num base(2-10)\t(q to quit):\n");
printf("Enter: ");
while (scanf(" %ld %d", &num, &bin) == 2){
if(bin>1&&bin<11){
to_base_n(&num,&bin);
putchar('\n');
printf("Enter: ");
}else(printf("base is out of range\nEnter: "));
}
return 0;
}
void to_base_n(unsigned long *n, int *b){
int r;
r = *n % *b;
if (*n >= *b){
*n = *n / *b;
to_base_n(n,b);
}
putchar('0' + (r % *b));
return;
}