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

Define what is the difference between active and passive filters?

1399


what is the use of FR-4(flame retardant)in PCB design why dielectric material used in inner layer in PCB design technology??

1540


WHAT R THE DIFFERENT CONFIGURATIONS OF FPGA

1597


What is a step-recovery diode and why is it so called ?

580


What is a rectifier?

623






What are the two types of control strategies?

608


Why cc configuration is called a voltage buffer? Define what is other name?

695


What is a lissajous pattern?

615


Why half-wave rectifiers are generally not used in dc power supply?

878


Synaptic conduction is mostly orthodromic because

2206


Explain the importance and effect of if in radio receiver?

596


Explain find conductivity, resistivity and resistance?

537


Give examples of linear circuits.

628


Explain the output of the lexical analyser?

543


hi i am electronics & telecomm engg & appling 4 the AAI jr executive (electronics/ATC) written test. pls forward me the syllabus & old question papers.I will be very much thankful to you. pis inform to

1595