@amol I was not sure that for every number that has 3 in its unit place has one multiple which has all one. So I used that is if the remainder is coming that already appeared stop there coz it will make stuck in a loop. for ex. remainders are 1 3 19 23 37 1 3 19 .... that will repeat.
but it in this case u can remove the set. Code will look more simpler. string all1Multiple(int x) { string s; int r=1; do { s += '1'; r = r % x; r = r * 10 + 1; } while(r != 1); return s; } -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.