29. Translate the following C program to Pep/9 assembly language: #include void getList(int ls[], int *n) {

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; 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

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Computer Systems

ISBN: 9781284079630

5th Edition

Authors: J Stanley Warford

Question Posted: