Kwazimoto
March 9th, 2011, 01:53 PM
since were talking about uni.... can anyone here write a commandline argument programme in C which accepts a aingle three digit integer, validates the input, and then performs the following procedure: sorts the number in descending and then asscending, subtracts the larger number from the smaller one, repeats the process until it converges then reports how many iterations it took to converge....
e.g. input the integer 132------ then------
321-123=198
981-189=792
972-279=693
963-369=594
954-459=495
954-459=495 and the process reapets endlessly, i.e. it has converged.......... couple of checks must be perfomed to validate the entered integer: 1. must not be zero 2. terms must not be equal e.g. 444
who ever can do this will win my........... vote when ever they suddenly have moderator aspirations, fair trade yes?
e.g. input the integer 132------ then------
321-123=198
981-189=792
972-279=693
963-369=594
954-459=495
954-459=495 and the process reapets endlessly, i.e. it has converged.......... couple of checks must be perfomed to validate the entered integer: 1. must not be zero 2. terms must not be equal e.g. 444
who ever can do this will win my........... vote when ever they suddenly have moderator aspirations, fair trade yes?