gota problem!!!

Oct 3, 2010 at 11:25am
how to take every digit of six digit number seprately.....i dont know where to start frm.... it would have been easy if it was six consecutive numbers but it is six digit number...
Oct 3, 2010 at 11:44am
use / and % for that.
/ removes digits from the end (example: 12345/10 = 1234)
% removes digits from the beginning (example: 12345%10 = 5)
Oct 3, 2010 at 1:36pm
thanks
Oct 3, 2010 at 3:50pm
Personally... I think its quite rude to double post...for anyone that doesnt know what I'm talking about he has the post open called "Solve the question!!!"

BTW What is percentage sign? I solved his problem on my own using devision and ceil and floor
Last edited on Oct 3, 2010 at 3:53pm
Oct 3, 2010 at 4:30pm
% is the modulo operator. Given X1%X2, the outcome would be similar to this:
1
2
3
4
5
6
unsigned operator%(unsigned x1, unsigned x2)
{
   while(x1>=x2)
      x1 -= x2;
   return x1;
}
Note: This code might not run properly, it's just used to illustrate the functionality.
Topic archived. No new replies allowed.