|
From: isaac2004 on 13 Feb 2006 13:54 hello i am new to ADA and being a math guy am trying to create a program that takes 3 inputs from a user, them being a starting integer, a stopping integer, and an indicated length. the goal of the program is to determine the sociable pair in the range with the required length. For example. user inputs following Start = 12000, Stop = 15000 and Length = 30 program would output This chain is 3 in length. 12285 14595 12285 This chain is 6 in length. 12496 14288 15472 14536 14264 12496 This chain is 6 in length. 14264 12496 14288 15472 14536 14264 This chain is 6 in length. 14288 15472 14536 14264 12496 14288 This chain is 29 in length. 14316 19116 31704 47616 83328 177792 295488 629072 589786 294896 358336 418904 366556 274924 275444 243760 376736 381028 285778 152990 122410 97946 48976 45946 22976 22744 19916 17716 14316 This chain is 6 in length. 14536 14264 12496 14288 15472 14536 This chain is 3 in length. 14595 12285 14595 notice that the final number in the chain is always equal to the starting number. this is called a sociable chain. can anybody help me in creating a program that would do this. thank you
|
Pages: 1 Prev: Dijkstra's algorithm Next: Ada95 skills test - Beta version(FREE) |