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
Im Simil,doing 6th semester Electronics & Communication Engineering.After completing my course I would like to be an integral part of Siemens technology.For dat when & how shoult I apply?
what are the various modes of data transfer in 8085?
What is pin diode?
What is the effect of temperature on extrinsic semiconductor?
How to call the "Procedure" in test bench for VHDL...? Please post the answer for it....?
Which questions ask for ccna certified candidates
1 explain advantage and dis advantages of FIR filters compared to IIRcouterparts ? 2 what is the need of filtering,ideal response of filters and actual response of filters ? 3 what is CMRR ? 4 which semiconductor device is used ad a voltage regulator and why ? 5 how can we rectify race around condition ?
What is zigbee?
12. Multiprogramming nd multithreading.. Which of these are better? a.multiprogramming b.multithreading c.depends on the system d.both are efficient
What are the applications of dc chopper?
3. What is the command to unlock the BTS
Define what is a high-pass filter?
What is meant by soa?
What losses occur in a thyristor during working conditions?
Define why are active filters preferred