mardi 26 novembre 2019

Check if digits of a number is an ascending sequence in C

I'm a student of C.S. and I have this question in C.

I need to create a program which get a number (any amount of digits, as long as positive), and check if the number itself is a sequence (increasing).

For example: The number 134679 is a sequence because 1 < 3 < 4 < 6 < 7 < 9. But if the number is 12354, than it's wrong because 1 < 2 < 3 < 5 > 4.

I've been ordered to use only if, else or even switch and loops such as while / do-while / for.

Now I realize that it is seem lazy of me to not give you a code I tried but I really don't know how to start. And I can't find anything on Google.

Any help will do.. thanks :)

Aucun commentaire:

Enregistrer un commentaire