/* Towers of Hanoi by recursion */
#include<stdio.h>
void toh(int,char,char,char);
int main()
{
int n=3;
toh(n,'A','B','C');
return 0;
}
void toh(int n,char a,char b,char c)
{
if(n==1)
printf("\nMoved from %c to %c",a,c);
else
{
toh(n-1,a,c,b);
toh(1,a,' ',c);
toh(n-1,b,a,c);
}
}
A Tech publication for all. Get Knowledge about Web Development, Programming, and trending news, tutorials, and tools for beginners to experts.
Friday, September 23, 2016
Subscribe to:
Post Comments (Atom)
B
BEING CODERS
Take Your Coding Journey Further!
Find more coding tutorials, technology insights, programming guides, and practical knowledge. Choose your reading experience below!
✦ Keep Learning. Keep Building. Keep Coding. ✦
-
1 23 456 78910 #include<stdio.h> int main() { int i,j,k; k=1; for(i=1;i<5;i++) { for(j=1;j<=i;j++) { printf("%d",k++);...
-
Learn how to configure Let’s Encrypt SSL on Windows 11 using Win-ACME and IIS. Securing your website with HTTPS is no longer optional—it’s a...
-
A fresh year brings fresh possibilities. ✨ New goals to work toward. New memories to make. New ideas waiting to take shape. But with so m...
-
Complete beginner-friendly guide to generate and install a free SSL certificate on Windows server If you’re running a website on Windows Se...
-
ABCDE BCDE CDE DE E #include <stdio.h> int main() { int i, j; for(i=1;i<=5;i++) { for(j=i;j<=5;j++) ...
-
1234567 12345 123 1 int main() { int i,j; for(i=7;i>=1;i-=2) { for(j=1;j<=i;j++) { printf("%d",j); } printf("\n");...
-
World Country, State and City Database in SQL and JSON Format (Step-by-Step Guide) If you want to add all countries, states/provinces, and ...
-
1 10 101 1010 10101 #include<stdio.h> int main() { int i,j,k; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) { printf("%d",j%2)...
-
How do you make a mark with a new company in a competitive market? How did Facebook reach its first $100 million mark in revenue? The answer...
-
🌍 World Geo Data — Full Country, State, City & Currency Dataset This repository provides an overview of the World Geo Data digital pro...
No comments:
Post a Comment