Question: 29. Translate the following C program to Pep/9 assembly language: #include void getList(int ls[], int *n) { int j; scanf(%d, n); for (j = 0;

29. Translate the following C program to Pep/9 assembly language:

#include

void getList(int ls[], int *n) {

int j;

scanf("%d", n);

for (j = 0; j < *n; j++) {

scanf("%d", &ls[j]);

}

}

void putList(int ls[], int n) {

int j;

for (j = 0; j < n; j++) {

printf("%d ", ls[j]);

}

printf("");

}

void rotate(int ls[], int n) {

int j;

int temp;

temp = ls[0];

for (j = 0; j < n - 1; j++) {

ls[j] = ls[j + 1];

}

ls[n - 1] = temp;

}

int main() {

int list[16];

int numItems;

getList(list, &numItems);

putList(list, numItems);

rotate(list, numItems);

putList(list, numItems);

return 0;

}

Sample Input 5 11 22 33 44 55 Sample Output 11 22 33 44 55 22 33 44 55 11

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Principles Algorithms And Systems Questions!