All pastes #923627 Raw Edit

cbr

public c v1 · immutable
#923627 ·published 2008-02-29 18:36 UTC
rendered paste body
#include <stdio.h>void hanoi(int disks, char tower_from, char tower_to, char tower_help) {	if(disks==1) {		printf("Take disk from tower %d to tower %d.\n",tower_from,tower_to);		return;	}	else {		hanoi(disks-1, tower_from, tower_help, tower_to);		printf("Take disk from tower %d to tower %d.\n",tower_from,tower_to);		hanoi(disks-1, tower_help, tower_to, tower_from);	}}int main(int disks) {	printf("Enter no of disks: ");	scanf("%d",&disks);	hanoi(disks, 1, 3, 2);}