How to split an integer into two parts the last digit and the rest in C

1 Answer

0 votes
#include <stdio.h>
#include <time.h>

int main(void) {
    int n = 89753;

    int part_a = n / 10;
    int part_b = n % 10;

    printf("%d %d", part_a, part_b);

    return 0;
}




/*
run:

8975 3

*/

 



answered Jun 15, 2022 by avibootz

Related questions

...