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 / vetrivel

#include<stdio.h>
int fact(int r)
{
if(r=0 || r=1)
return 1;
else
return(r*fact(r-1);
}
void main()
{
int a,n,rem,sum=0
printf("Enter the number\n");
scanf("%d",&n);
a=n;
while(n!=0)
{
rem=n%10;
sum=sum+fact(rem);
n=n/10;
}
if(sum==a)
printf("%d is a strong number",a);
else
printf("%d is not a strong number",a);
}

Is This Answer Correct ?    8 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are comments included during the compilation stage and placed in the EXE file as well?

1066


Write a c program to demonstrate character and string constants?

2169


What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

1102


why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

1141


What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.

2246


What are the advantages and disadvantages of a heap?

1197


Can we add pointers together?

1045


Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.

1096


What is a char in c?

975


Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

2035


How can I run c program?

1155


What is time null in c?

1063


What is an operator?

1061


How can you increase the size of a statically allocated array?

1066


What is c basic?

1158