Question: I'm in a assembly language class, and I need to translate the C code I wrote for towers of hanoi into MIPS assembly The C

I'm in a assembly language class, and I need to translate the C code I wrote for towers of hanoi into MIPS assembly

The C code I developed:

#include

void hanoi(int, char , char , char );

int main() {

int N;

scanf("%d", &N);

hanoi(N,'1', '3', '2');

return 0;

}

void hanoi (int N, char A, char B, char C) {

if (N >=1){

hanoi (N-1, A, C, B);

printf("Move disk %d from Peg %c to Peg %c ", N, A, B);

hanoi(N-1, C, B, A);

}

}

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 Databases Questions!