rendered paste body#include <stdio.h>#include <string.h>#include <stdlib.h>void hanoi(int disks, char tower_from, char tower_to, char tower_help, size_t r) { char * tabs = calloc(r + 1, sizeof(char)); size_t i = r; while (i--) strcat(tabs, "\t"); if(disks==1) { printf("%s(%d) %d->%d.\n",tabs,disks,tower_from,tower_to); free(tabs); } else { hanoi(disks-1, tower_from, tower_help, tower_to, r + 1); printf("%s(%d) %d->%d.\n",tabs,disks, tower_from,tower_to); free(tabs); hanoi(disks-1, tower_help, tower_to, tower_from, r + 1); }}int main(void) { int disks; printf("Enter no of disks: "); scanf("%d",&disks); hanoi(disks, 1, 3, 2, 0); return 0;}