Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to check whether a given integer is a strong
number or not?
[Hint:
145=1!+4!+5!
=1+24+120
=145]

Answer Posted / prasad

int fact(int);
void main()
{
int sum=0,n,f,temp;
clrscr();
printf("enter the numnber u want to check:");
scanf("%d",&n);
temp=n;
while(n>o)
{
n=n%10;
f=fact(n);
sum=sum+f;
n=n/10;
}
if(sum==temp)
{
printf("given num %d is strong number:");
else
printf("given num %d is not a strong number:");
}
getch();
}
int fact(int n)
{
if(n==0)
return(1);
else
return n*fact(n-1);
}

Is This Answer Correct ?    11 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you know the use of 'auto' keyword?

1267


Explain the use of 'auto' keyword in c programming?

1185


What is the use of sizeof () in c?

1100


How can you access memory located at a certain address?

1164


Explain union.

1238


What is context in c?

977


The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference

1291


What is console in c language?

1143


When was c language developed?

1260


What is #include stdio h?

1180


the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above

1100


What do the functions atoi(), itoa() and gcvt() do?

1247


What is a global variable in c?

1079


Is main is a keyword in c?

1176


What is variable and explain rules to declare variable in c?

1181