Find error for curious number, Data Structure & Algorithms

Assignment Help:
#include
#include
int sumFact(int numb);
int calculateFactorial(int digit);

main()
{
int numb, sumfact;
do{
printf ("Enter a number 1 to 9999\n");
scanf("%d", numb);
printf("\n");
}
while (!(numb >= 1 && numb <=9999));
sumfact = sumFact(numb);
if (numb == sumfact)
{
printf("\nThe Number %d you entered is curious number", numb);
}
else
{
printf("\n not a curious number", numb);
}
}
int sumFact (int numb)
{
int rightdigit, sumfact = 0;
while (numb != 0)
{
rightdigit = numb%10;
numb = numb /10;
sumfact = sumfact + calculateFactorial (rightdigit);
}
return sumfact;
}
int calculateFactorial (int digit)
{
int factval;
if ((digit == 0 ) && (digit == 1))
{
return (1);
}
else
{
factval = digit*calculateFactorial (digit-1);
return factval;
}
}

Related Discussions:- Find error for curious number

Tree, application of threaded binary treee

application of threaded binary treee

Design a time algorithm, Q. An, array, A comprises of n unique integers fro...

Q. An, array, A comprises of n unique integers from the range x to y(x and y inclusive where n=y-x). Which means, there is only one member that is not in A. Design an O(n) time alg

Tree traversal, Q. What do you understand by the tree traversal? Write down...

Q. What do you understand by the tree traversal? Write down the procedure for traversing a binary tree in preorder and execute it on the following tree.    Ans: Th

Array vs. ordinary variable, Q. Describe what do you understand by the term...

Q. Describe what do you understand by the term array? How does an array vary from an ordinary variable? How are the arrays represented in the specific memory?

Abstract Data Types, A useful tool which is used for specifying the logical...

A useful tool which is used for specifying the logical properties of a data type is called the abstract data type or ADT. The term "abstract data type" refers to the fundamental ma

Storing a sparse matrix in memory, Explain an efficient method of storing a...

Explain an efficient method of storing a sparse matrix in memory. Write a module to find the transpose of the sparse matrix stored in this way. A matrix which contains number o

What is keyed access- container, What is Keyed Access- Container A c...

What is Keyed Access- Container A collection may allow its elements to be accessed by keys. For instance, maps are unstructured containers which allows their elements to be

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd