Question: IN C PROGRAMMING!!!! No C++. or C# JUST C Please! 1) a.Write a function which returns the sum of the digits of an integer value.

IN C PROGRAMMING!!!! No C++. or C# JUST C Please!

1) a.Write a function which returns the sum of the digits of an integer value. You must use recursion. Example sum (765) = 18, sum (16978) = 31, etc.

b. Write a function which recursively reverses a string.

c. Tower of Hanoi: A very popular mathematical game or puzzle is referred to as the Tower of Hanoi. The idea behind the game is to find an efficient method for moving disks between three posts. Each disk has a different diameter, but all of them can be placed on the available posts. The goal of the game is to move all of the disks from one post to another according the following rules:

1. Only one disk may be transferred at a time

2. Only the top disk on any post may be accessed at a given time

3. No disk may be placed on top of a smaller disk at any point

At the start of the game, all of the disks must originally be placed such that the largest disk is on the bottom of the stack of one post, and the smallest is on the top of the stack on the same post. The disks should form a cone shape. Write a program to simulate the Tower of Hanoi game. For each move print the post number (1 3) from which the disk is taken, the diameter of the disk, and the resulting post on which the disk is placed. Also, show the current diameter of the disks on each post. You must use recursion to solve this problem! Initially start with three disks in your game. Note: if you visit http://towersofhanoi.info/Animate.aspx, you will find an animation of how Tower of Hanoi should run.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!