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
Define what is the difference between active and passive filters?
what is the use of FR-4(flame retardant)in PCB design why dielectric material used in inner layer in PCB design technology??
WHAT R THE DIFFERENT CONFIGURATIONS OF FPGA
What is a step-recovery diode and why is it so called ?
What is a rectifier?
What are the two types of control strategies?
Why cc configuration is called a voltage buffer? Define what is other name?
What is a lissajous pattern?
Why half-wave rectifiers are generally not used in dc power supply?
Synaptic conduction is mostly orthodromic because
Explain the importance and effect of if in radio receiver?
Explain find conductivity, resistivity and resistance?
Give examples of linear circuits.
Explain the output of the lexical analyser?
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