This program reads in a string from standard input, and prints the string back out with upper- and lower-case characters reversed, followed by a newline. Specifics:
1. Our Y86 variant has no byte-oriented instructions. You will need to store each character in an integer-sized slot, i.e. four bytes.
2. You may assume that the string is less than or equal to 10 characters, plus a null byte.
3. The input will consist solely of a sequence from the characters a-z and A-Z, followed by a newline. The newline is not part of the string.
4. Upon receipt of the newline, input is done. The input string does not include the newline, and should be null-terminated. In other words, the string will take at most 11 * 4 = 44 bytes.
5. The program splits up naturally into a readstr(), a printstr(), and a mutate() function. You don’t have to do this, but note that readstr() and printstr() will be very useful in the third program, so it would pay to write them once and then copy them over.
2.2 Fibonacci program
This program begins execution by reading a single integer (called n) from standard input. It then prints out the nth Fibonacci number (Fn), followed by a newline, via a recursive algorithm. For the purposes of this assignment, we define F0 = 0, F1 = 1; for all other values of n, Fn = Fn?1 + Fn?2.
You may assume that the value n is in the interval [0, 14] (so that it doesn’t take too long to simulate). Note that you must implement this program in a recursive manner, and not iteratively.
This program reads in a string and then, using the characters in the string, generates all possible permutations, and prints them out on a single line. There should be a single space between them, and no space before the first or after the last.
For example, given ’abc’, you print:
abc acb bac bca cab cba
• Theinputstringwillconsistsolelyofasequencefromthecharactersa-z,followedbyanewline. The newline is not part of the string.
• Each character in the input will be unique. You will not be given ’aab’, or even ’aba’.
• You should print the permutations out in the “natural” order, as above, i.e. first try the first
character of the input string, then the second character of the input string, etc.
• The input string will not be more than 5 characters.
• You are probably best off writing this program recursively, as in the C version.
• The string will not have more than five characters.