Lab RISC-V
Lab RISC-V
Members Date
Performed
Answer Question
Programming Exercises:
Place your code on the box provided. Provide a screenshot that your code works.
1. Write a program that asks for two signed decimal inputs then display the sum,
difference, product, quotient, and remainder of the two numbers. Should support output
value up to +/- (231-1). Provide a screenshot with a test case demonstrating that your
code works.
Screenshot
2. Write a RISC-V program to compute for the perimeter and area of a square. The side of
the square is obtained from the input prompt. Output the required result. There should
be an error check for negative input. Support output value up to 232 -1. Provide a
screenshot with a test case demonstrating that your code works.
Enter length: 20
Perimeter: 80
Area: 400
-----------
Enter length: -20
Error: Negative input not allowed, please try again.
Enter length: 2
Perimeter: 8
Area: 4
Screenshot
3. Write a program that computes the arithmetic mean of N input numbers. N is provided as
an input that precedes the numbers to be averaged. Provide a screenshot with a test
case demonstrating that your code works.
N: 4
3
7
3
7
Mean: 5
Screenshot