DropsBrowse Pastes
Login with GitHub

2-3

March 1st, 2022Views: 14(0 unique)C
#include <stdio.h>
#include <math.h>

int fun(int);

int main(void)
{
    int s;
    scanf("%d", &s);
    printf("%d\n", fun(s));
    return 0;
}

int fun(int s)
{
    int i = 1, t = 0, n = 0;
    while (s > 0)
    {
        if (!(i++ % 2))
        {
            t += s % 10 * pow(10, n++);
        }
        s /= 10;
    }
    return t;
}