Use the program EASY68K Write a program in Easy68K to fulfill the following func
ID: 3856383 • Letter: U
Question
Use the program EASY68K
Write a program in Easy68K to fulfill the following functions:
a) Create an array with size 10. Initialize the array as [4 5 1 8 3 6 2 3 0 7].
b) Read one number from the keyboard with instructions (index). (3 points.)
c) Display the (index % 10)th number from the initialized array, index starts from 0. (4 points.)
Output format:
Input the index to display: 9
The value is: 7
Another Output format:
Input the index to display: 12
The value is: 1
Paste your code and screenshots here.
Thank You :)
Explanation / Answer
I am writing below the code of the program in c++
#include<iostream.h>
#include<conio.h>
Void main()
{
int array[10]={4,5,1,8,3,6,2,3,0,7}; // array is declared and initialised
int index=0; // index variable declared and initialised to zero
int c;
cout<<"Input the index to display";
cin>>index;
c = index%10; // the output of index%10 will be stored in variable in c
cout<<"The value is :"<< array[c] ;
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.