Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ctype.h>
- #include <stdio.h>
- #include <stdlib.h>
- int main(void) {
- int x;
- double ans = 0, multipl = 1;
- int digit = 0, integer = 1;
- while ((x = getchar()) != EOF) {
- if (x == '.') {
- integer = 0;
- } else {
- if (isdigit(x)) {
- digit = 1;
- if (integer == 1) {
- ans = ans * 7 + (x - '0');
- } else {
- multipl /= 7;
- ans += multipl * (x - '0');
- }
- } else {
- if (digit == 1) {
- printf("%.10g\n", ans);
- ans = 0; multipl = 1;
- digit = 0; integer = 1;
- }
- }
- }
- }
- if (digit == 1) {
- printf("%.10g\n", ans);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement