#include<stdio.h>
/*************************************************************************/
void towers(int n,char frompeg,char topeg,char auxpeg)
{
	if(n==1)
	{
	printf("\n%s%c%s%c","move disk 1 from peg ",frompeg," to peg ",topeg);
	return;
	}

	towers(n-1,frompeg,auxpeg,topeg);
	printf("\n%s%d%s%c%s%c","move disk ",n," from peg ",frompeg,
	"to peg",topeg);
	towers(n-1,auxpeg,topeg,frompeg);
}
/************************************************************************/
void main()
{
	int n;
	scanf("%d",&n);
	towers(n,'A','B','C');
}

Interesting, please try to stick to the Standard.
It's int main (void), not void main()

;) :idea: :rolleyes: :surprised :cool: :twisted: :p :?: :cheesy: :mrgreen: :) :!: :confused: :lol: :eek: :-| :mad: :sad: THATS MY COMMENT

Comments
Twit