CIS22A
- Fall 2019 - Lab Exercise 9
due Wednesday, 11/20 8:30 am
Lab
exercises are not accepted late.
Put your name, Lab
Exercise 9, and compiler and the operating system used in a
comment at the top
of your program. Email only your source code. Your source code should
be sent as an attachment (with the name ex9.cpp).
Use
"Ex9" as the subject of
your
email submission
Program
Requirements
Write
a program that uses a 10 elements array of type int. Write a loop
in which you assign random even numbers between 2 and 100 (inclusive)
to each element of the array. Write another loop in which you
print on one line the array element index, the array value, and the
square root of the array value. Each number should be displayed
with a width of 8 and the square root value should be displayed with 3
decimal place accuracy. The output should look something like
this:
0 84 9.165 1 36 6.000 2 70 8.367 3 2 1.414 4 40 6.325 5 50 7.071 6 58 7.616 7 18 4.243 8 26 5.099 9 30 5.477
|