• Home
  • Blog
  • Translate a C program to pep9 language.

Translate a C program to pep9 language.

0 comments

I already translate the program but its the non function one (please see the pdf attachment). However this assignment ask to use functions which I dont know how.

I need someone who knows pep9 language and able to translate a C program into pep9 language.

I also provide the code I wrote for the same outcome without functions. (Attachment pdf)

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

please look at the sample input and output at the bottom of this code. basically you enter 5 meaning the list is 5 double integers, then you enter 5 numbers such as 11 22 33 44 55 and the output should rotate the numbers and print 22 33 44 55 11

#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(“n”);
}
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

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}