DonanımHaber Mini sürüm 2 Ocak 2026 tarihi itibariyle kullanımdan kalkacaktır. Bunun yerine daha hızlı bir deneyim için DH Android veya DH iOS uygulamalarını kullanabilirsiniz.
Yarın bu programın nasıl çalıştıgını kaba taslak anlatmam gerek,açıklayabilecek biri varmı kısaca
#include "stdio.h" void hanoi(int,char,char,char); void hanoi(int n,char frompeg,char topeg,char auxpeg) { if(n==1) { printf("\nMove disk 1 from peg %c to peg %c",frompeg,topeg); return; } hanoi(n-1,frompeg,auxpeg,topeg); printf("\nMove disk %d from peg %c to peg %c",n,frompeg,topeg); hanoi(n-1,auxpeg,topeg,frompeg); } main() { int n; printf("<<< Please, enter the number of disks >>> : "); scanf("%d",&n); printf("The Tower of Hanoi involves the moves :\n\n"); hanoi(n,'A','C','B'); return 0;
#include "stdio.h"
void hanoi(int,char,char,char);
void hanoi(int n,char frompeg,char topeg,char auxpeg)
{ if(n==1)
{ printf("\nMove disk 1 from peg %c to peg %c",frompeg,topeg);
return; }
hanoi(n-1,frompeg,auxpeg,topeg);
printf("\nMove disk %d from peg %c to peg %c",n,frompeg,topeg);
hanoi(n-1,auxpeg,topeg,frompeg);
}
main()
{ int n;
printf("<<< Please, enter the number of disks >>> : ");
scanf("%d",&n);
printf("The Tower of Hanoi involves the moves :\n\n");
hanoi(n,'A','C','B');
return 0;
getch();
}