Untitled
raw download clone
C
views 27
,
size 621 b
#include<stdio.h>

int main(void){

    double n;
    double a, b, c, x, y, z;

    //ex: 123.456

    scanf("%lf", &n);

    a = n / 100;
    b = (int)n / 10 % 10;
    c = (int)n % 10;

    x = (int)(n * 10) % 10;
    y = (int)(n * 100) % 10;
    z = (int)(n * 1000) % 10;

    int p, o, i;
    p = (int)x;
    o = (int)y;
    i = (int)z;

    //printf("%f %f %f %d %d %d\n", a, b, c, p, o, i);

    double N;

    N = (int)c*100 + (int)b*10 + (int)a + (float)i/10 + (float)o/100 + (float)p/1000;

    //printf("%f %f %f\n", p, o, i);
    printf("%.3f", n + N);

    return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.