Description
Amir Mirzaei
Your task is to read a positive integer from the standard input and decide whether its digits (from left to right) are in ascending order, descending order, both (all digits are equal) or neither. Print “Ascending”, “Descending”, “Both” or “Neither” to the standard output. All of the input numbers are positive.
90% of the score is given for deciding whether digits are ascending or not, in which case you only print “Ascending” or “Not”.
Your code must comply with the following rules:
● You can only use the EAX, EBX, ECX, EDX, ESI and EDI registers.
● You are not allowed to use memory and data segments except for storing the output strings (“Ascending”, “Descending”, etc.).
● You must use the read_int and print_string functions (from the textbook) for I/O.
● You can only use the commands you have learned so far in the class.
You cannot use MUL, IMUL, DIV, IDIV, etc.
● DO NOT PRINT EXTRA OUPUT. Results are checked by Script.
● PRINT A SINGLE NEWLINE CHARACTER AT THE END OF YOUR
asc_message: db “Ascending”, 10, 0
Remember that your code will be checked for similarity. In the case of cheating the student will receive a negative point. It is your responsibility to protect your code.
Please upload only the “.asm” file on courses.kntu.ac.i r.
Example:
Input 1:
359
Output 1:
Ascending
Input 2:
4444
Output 2:
Both
Input 3:
739
Output 3:
Neither
Input 4:
741
Output 4:
Descending If you choose to just check for the ascending order (and receive 90% of the score), your output must look like this:
Input 1:
359
Output 1:
Ascending
Input 2:
4444
Output 2:
Ascending
Input 3:
739
Output 3:
Not
Input 4:
741
Output 4:
Not
Reviews
There are no reviews yet.