OAIP_Mirror/conversions/main.c
2024-11-10 13:45:07 +04:00

15 lines
288 B
C

#include <stdio.h>
#include <math.h>
int main() {
double n = 0.33;
double sum = 0;
int base = 8;
for (int i = 0; i < 10; i++) {
printf_s("%d", (int)(n * base));
sum += (int)(n * base) * pow(base, -1 - i);
n = n * base - (int)(n * base);
}
printf_s("\n%lf", sum);
return 0;
}