Monday, May 24, 2010

Problem regarding verifying whether number in a sequence are in ascending order or not?

i m a new student of c language...in our class turbo c is used...n we r now learning loop %26amp; nested loop.yesterday we got this assignment...i ve managed to write the program %26amp; it is working only for 3 numbers...as example if da input is 1 3 5.output shows yes %26amp; if it is 152.it shows no...bt when i m giving 5 output it is showing da wrng output like whn i giv 15629 output says yes!!How can i solve dis problem?%26amp; in my assign ment i was asked to print upto the last number whr da order is rite.like i finput is 135 92 output should be "no" %26amp; "upto 9 the series is in ascending order.."how can i write dis....plz help meeeee.......n plz give solution dat is suitable to turbo c and plz use only loop as i will not understand other systems as i vent studied bout dem....

Problem regarding verifying whether number in a sequence are in ascending order or not?
you should verify you're moving through your loop the proper number of times, using some simple tracing.





as long as you're properly saving the current number into some variable, your test to check for ascending order should work. This should happen at the bottom of your loop.


No comments:

Post a Comment