answersLogoWhite

0

How do you solve the c programme of tree of hanoi?

Updated: 8/19/2019
User Avatar

Wiki User

13y ago

Best Answer

It is the "Tower of Hanoi" and it is a puzzle. When you can solve the puzzle you can write the program, when you have learned enough to write simple programs.

You do want to be able to write computer programs, don't you?

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you solve the c programme of tree of hanoi?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you use this function in c programme?

I don't use that function in C programme.


Write a c program to implement tower of hanoi moves?

/* hanoi.c */ #include <stdio.h> #include <stdlib.h> static long step; static void Hanoi (int n, int from, int to,int spare) { if (n>1) Hanoi (n-1,from,spare,to); printf ("Step %ld: move #%d %d-->%d\n", ++step, n, from, to); if (n>1) Hanoi (n-1,spare,to,from); } int main (int argc, char **argv) { int n; if (argc==1 (n= atoi(argv[1]))<=0) n= 5; step= 0; Hanoi (n, 1, 2, 3); return 0; }


Write an Algorithm for towers of hanoi?

#include#includevoid hanoi(int x, char from,char to,char aux){if(x==1){printf("Move Disk From %c to %c\n",from,to);}else{hanoi(x-1,from,aux,to);printf("Move Disk From %c to %c\n",from,to);hanoi(x-1,aux,to,from);}}int main(void){int disk;clrscr();printf("Enter the number of disks you want to play with:");scanf("%d",&disk);double moves=pow(2,disk)-1;printf("\nThe No of moves required is=%g \n",moves);hanoi(disk,'A','C','B');getch();}


Make programme for multification of three no in c plus plus?

result = a * b * c;


How do you solve a equals b plus c plus d solve for c?

If: a = b+c+d Then: c = a-b-d


How do you solve C equals 43.96 cm?

There is nothing to solve. C = 43.96 cm!


How many keywords are there in c?

answer:32 programme to print factorial of a given number in c languages


One line programme in c language?

int main (void) { printf ("One line programme\n"); return 0; }


Move 5 disks in the tower of hanoi algorithm?

/* tower of hanoi using recursion */ #include<stdio.h> int main(void) { unsigned int nvalue; char snvalue = 'L' , invalue = 'C' , dnvalue = 'R' ; void hanoi(unsigned int , char , char , char); printf(" enter number of disks : "); scanf("%u",&nvalue ); printf("\n\ntower of hanoi problem with %d disks \n ", nvalue )" hanoi(nvalue , snvalue , invalue , dnvalue ); printf("\n"); return 0 ; } void hanoi(unsigned n , char snd1 , char ind1 , char dnd1 ) { if(n!=0) { /* move n-1 disks from starting to intermadiate needles */ hanoi(n-1 , snd1 , dnd1 , ind1 ); /* move disk n from start to destination */ printf("move disk %d from %c to %c\n ", n , snd1 , dnd1); /* move n-1 disks from intermediate to destination needle */ hanoi(n-1 , ind1 , snd1 , dnd1 ); } }


What is a statement in c language programme?

Any experssion including assignment or a function call can be a statement in C


C programme for symmetric and skew symmetric matrices?

#include<iostream.h>


What music is played in the inspector purbright programme?

String Quintet in C is the music that is played in the inspector Purbright Programme. It the music is played by Schubert.