write a C programme to print all the strong numbers below 10000..

Answer Posted / shiv darshan

#include<stdio.h>
int main(){
int num,i,f,r,sum,temp;
int max;


printf("Enter maximum range: ");
scanf("%d",&max);

printf("Strong numbers in given range are: ");
for(num=1; num <= max; num++){
temp = num;
sum=0;

while(temp){
i=1;
f=1;
r=temp%10;

while(i<=r){
f=f*i;
i++;
}
sum=sum+f;
temp=temp/10;
}

if(sum==num)
printf("%d ",num);
}
return 0;
}


Definition of strong number:

A number is called strong number if sum of the factorial of its digit is equal to number itself. For example: 145 since
1! + 4! + 5! = 1 + 24 + 120 = 145

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I am perparing for DMRC Jr. Engineer Post. Please post me reference book Name At my Id laxman.negi@gmail.com

1959


what is pla instruction

2714


How WDM works in wireless system...as we say that it works in optical and signals transmitted in this are light signals...??

1343


Define fan-in and fan-out?

542


What are the applications of fm transceiver.

626






Name the equipments required for 2+2+2.

1483


regarding bsnl jto examination,can i use the printout of application format mentioned in the advertisement.

1471


please explain the meaning of "In GSM only 30 or 35 peoples can call at at time in a singal carrier but In CDMA apprx 70 peoples can call in a singal carrier at a time."..........

1489


Explain in details how you would react to an unexpected incident when your supervisor or manager is not around to give instructions?

1891


SIR I faced two exams for the junoior Engg. but i do not passed them so sir i requested sir u send me question papers for technicallly for elect& comm engg.

1650


What is the main drawback of a dual slope adc?

655


objective questions & answers in c & c++ software languages

2526


how can I pass ccna in first try in one month

1701


What is intrinsic semiconductor ?

620


What are the differences between combinational circuits and sequential circuits?

551