#include <stdio.h>
#include <math.h>
int main(int argc, char**argv)
{
int q;
int numDigitsOfB;
int divisor;
int a,b;
// Set the number of digits desired for b
numDigitsOfB = 3;
// Calc 10 to the 'numDigitsOfB' power
divisor = (int)pow(10.0,(double)numDigitsOfB);
q = 1234567;
// To understand why this works, you need to understand integer division in C/C++
a = q / divisor;
b = q % divisor;
printf("%d %d %d %d %d\n",numDigitsOfB,divisor,q,a,b);
}
Be sure to come back and let us know if our suggestions helped!