Write a program largers that reads two numbers from stdin


Write the following simple programs in ARM assembly language. You cannot use gcc-S as a "template". You have to write your own programs by hand in assembly.

1. Write a program larger.s that reads two numbers from stdin, and prints the larger of the two numbers. The numbers can be positive, negative, or zero. To input the numbers to your program, you can use 'scanf' or something similar. Type one number followed by the enter key, then type the second number followed by the enter key, and then print the result to the terminal by using 'printf' or something similar. An example of what the output should look like is shown below.

pi@raspberrypi:∼/cs250/lab-src$ ./larger

-5

7

7

pi@raspberrypi:∼/cs250/lab7-src$ ./larger

1501

0

1501

2. Write a program length.s that reads a string Morn stdin and prin. the length of the string. You cannot use the C library function "strlen in this assignment. The length of the string is guaranteed to be less than 100 characters long, and there will be no while space. Type the string in the terminal and output the length to the terminal. An example output is shown below.

pi@raspberrypi:∼/cs250/lab7-src$ ./length

HelloWorld!

11

pi@raspberrypi:∼/cs250/lab7-src$ ./length

12345678901234567890

20

3. Write a program sumarray.s that reads 5 numbers from stdin and prints the sum of the numbers. The number of inputs is arbitrary and could be many more, so use a loop to read in the 5 numbers. For example, a loop would look like this. In other words, do not copy/paste the scanf and format character 5 times in your Program.

while x < 5

input [x] = scanf("%d")

x++

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Write a program largers that reads two numbers from stdin
Reference No:- TGS01666117

Expected delivery within 24 Hours