I thought about it some more, and realize that my code wasn't correct. Try this: int n = <the number that ends with 3>; // e.g., int n = 13; int d = 1; while( d % n != 0 ) { printf("1"); d = 10 * (d % n) + 1; } printf("1\n");
On Friday, September 21, 2012 11:07:29 AM UTC-5, Dave wrote: > @Navin: No problem. Just print a 1 instead of a quotient digit > > . That makes the code even simpler, like this: > > int n=<the number that ends with 3>; > int divisor=1; > printf("1"); > while( divisor != 0 ) > { > printf("1"); > divisor = 10 * (divisor % n) + 1; > } > printf("\n"); > > Dave > > On Friday, September 21, 2012 2:05:55 AM UTC-5, Navin Kumar wrote: > >> @Dave sir: Thanx for reply. your solution gives the exact multiple like >> 37 for 3, 8547 for 13. In the question i think we have to print the number >> which is 13x8547 ....which will be very large (out of integer range).In >> that case we have to store result in string. >> >> >> On Fri, Sep 21, 2012 at 12:09 PM, Dave <dave_an...@juno.com> wrote: >> >>> @Navin: It means that given a positive integer n whose decimal >>> representation ends in 3, find a multiple, m*n, which is written solely >>> with the digit 1. E.g., 3: 37 * 3 = 111; 13: 8547 * 13 = 111,111. >>> >>> Dave >>> >>> On Thursday, September 20, 2012 11:56:08 PM UTC-5, Navin Kumar wrote: >>> >>>> @all: Please explain question number 8. I am not getting the question >>>> exactly what it says ? >>>> >>>> On Fri, Sep 21, 2012 at 9:30 AM, Dave <dave_an...@juno.com> wrote: >>>> >>>>> @Bharat: Simulate long division, dividing a number 1111...1 by the >>>>> number. You can do this one digit at a time, printing the quotient digit >>>>> by >>>>> digit until you "bring down" a zero. It could look something like this: >>>>> >>>>> int n=<the number that ends with 3>; >>>>> int divisor=1; >>>>> while( divisor < n ) >>>>> divisor = 10 * divisor + 1; >>>>> while( divisor != 0 ) >>>>> { >>>>> printf("%d",divisor / n); >>>>> divisor = 10 * (divisor % n) + 1; >>>>> } >>>>> printf("\n"); >>>>> >>>>> Dave >>>>> >>>>> On Thursday, September 20, 2012 9:45:55 PM UTC-5, bharat wrote: >>>>> >>>>>> what is the solution(not brute force) for 8th question ? >>>>>> >>>>>> On Fri, Sep 14, 2012 at 5:19 PM, Bhupendra Dubey <bhupen...@gmail.com >>>>>> > wrote: >>>>>> >>>>>>> Which edition of barron? >>>>>>> >>>>>>> >>>>>>> On Wed, Sep 28, 2011 at 6:05 PM, VIHARRI <vihar...@gmail.com> wrote: >>>>>>> >>>>>>>> 1. Java uses stack for byte code in JVM - each instruction is of one >>>>>>>> byte, so how many such instructions are possible in an operating >>>>>>>> system. >>>>>>>> >>>>>>>> 2. Three processes p1, p2, p3, p4 - each have sizes 1GB, 1.2GB, 2GB, >>>>>>>> 1GB. And each processes is executed as a time sharing fashion. Will >>>>>>>> they be executed on an operating system. >>>>>>>> >>>>>>>> 3. write a recursive program for reversing the linked list. >>>>>>>> >>>>>>>> 4. write a program for checking the given number is a palindrome. >>>>>>>> ( dont use string / array for converting number ). >>>>>>>> >>>>>>>> 5. write a recursive program for multiplying two numbers a and b, >>>>>>>> with >>>>>>>> additions. The program should take care of doing min # additions as >>>>>>>> that of which ever number is lower between a and b. >>>>>>>> >>>>>>>> 6. There are two sets A and B with n integers, write a program to >>>>>>>> check the whether there exists two numbers a in A and b in B such >>>>>>>> that >>>>>>>> a+b = val ( val is given ); >>>>>>>> >>>>>>>> 7. write a program to return the row number which has max no of >>>>>>>> one's >>>>>>>> in an array of NxN matrix where all 1's occur before any 0's starts. >>>>>>>> >>>>>>>> 8. For every number that has 3 in its units place has one multiple >>>>>>>> which has all one's i.e. 111 is such multiple and 13 has a multiple >>>>>>>> 111111. Write a program to find such multiple for any number that >>>>>>>> has >>>>>>>> 3 at its units place. >>>>>>>> >>>>>>>> 9. what are the maximum no of edges that can be connected in a graph >>>>>>>> of n vertices and 0 edges such that after adding edges given graph >>>>>>>> is >>>>>>>> still disconnected. >>>>>>>> >>>>>>>> 10. One Question on critical section. >>>>>>>> >>>>>>>> For Analytical Test - Prepare the Questions in the barrons book of >>>>>>>> sample paper - 2 ( they have give two passages ) >>>>>>>> >>>>>>>> -- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "Algorithm Geeks" group. >>>>>>>> To post to this group, send email to algo...@googlegroups.com. >>>>>>>> To unsubscribe from this group, send email to algogeeks+...@** >>>>>>>> googlegroups.com**. >>>>>>>> >>>>>>>> For more options, visit this group at http://groups.google.com/** >>>>>>>> group**/algogeeks?hl=en<http://groups.google.com/group/algogeeks?hl=en> >>>>>>>> . >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Thanks & regards >>>>>>> Bhupendra >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "Algorithm Geeks" group. >>>>>>> To post to this group, send email to algo...@googlegroups.com. >>>>>>> To unsubscribe from this group, send email to algogeeks+...@** >>>>>>> googlegroups.com**. >>>>>>> >>>>>>> For more options, visit this group at http://groups.google.com/** >>>>>>> group**/algogeeks?hl=en<http://groups.google.com/group/algogeeks?hl=en> >>>>>>> . >>>>>>> >>>>>> >>>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Algorithm Geeks" group. >>>>> To view this discussion on the web visit https://groups.google.com/d/* >>>>> *msg/algogeeks/-/pDBPxDR3R1oJ<https://groups.google.com/d/msg/algogeeks/-/pDBPxDR3R1oJ> >>>>> . >>>>> >>>>> To post to this group, send email to algo...@googlegroups.com. >>>>> To unsubscribe from this group, send email to algogeeks+...@** >>>>> googlegroups.com. >>>>> For more options, visit this group at http://groups.google.com/** >>>>> group/algogeeks?hl=en <http://groups.google.com/group/algogeeks?hl=en> >>>>> . >>>>> >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Algorithm Geeks" group. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msg/algogeeks/-/LpHDrQKDb90J. >>> >>> To post to this group, send email to algo...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/xgiur2tbu04J. 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.