Convert the below c++ code to corresponding Pep/9 assembly language. #include // include the required header files using namespace std; int arr[20], num, temp, i; // declare the required variable int main() { cin >> num; // take the number of elements of the array for (i = 0; i < num; i++) { cin >> arr[i]; // take the elements from the user } temp = arr[0]; for (i = 0; i < num; i++) // loop to move the content of the array { arr[i] = arr[i + 1]; }
Convert the below c++ code to corresponding Pep/9 assembly language.
#include <iostream> // include the required header files
using namespace std;
int arr[20], num, temp, i; // declare the required variable
int main()
{
cin >> num; // take the number of elements of the array
for (i = 0; i < num; i++)
{
cin >> arr[i]; // take the elements from the user
}
temp = arr[0];
for (i = 0; i < num; i++) // loop to move the content of the array
{
arr[i] = arr[i + 1];
}
arr[num - 1] = temp;
for ( i = 0; i < num; i++) // loop to display the content of the final array
{
cout << arr[i] << ' ';
}
cout << endl;
return 0;
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps