Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
354 B
4
Indexable
Never
int reverseInt(int luku) {
    int reverse = 0, digit = 0, luvunOsa = luku;
    while(luku > pow(10, digit)) {
        digit++;
        int loppu = luvunOsa % 10;
        luvunOsa = luvunOsa / 10;
        reverse = reverse * 10 + loppu;
    }
    return reverse;
}

int main()
{
    int lukur = reverseInt(1234);
    printf("%d", lukur);

    return 0;
}