write a C programme to print all the strong numbers below 10000..
Answer / 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 |
in govt polytechnic lecturers tell me what is the expected cut off for ece after the interview list announced
what is an excitation table?
What are the limitations of the basic differentiator circuit?
construction of current tranformer
i need modal Q. paper of junior enjineer for 1/2009 rrb ajmer exam cat no. 11 jell electrical thenkyou
find wrong number 76,20,32,84,325,1580
What are boolean algebra and boolean expression?
what is an integrator?
what is the meaning of crest factor
WAP to print a given number [0-1000] in words. For example, 123 as One Hundred and Twenty Three
Difference between SONAR and RADAR? Can we use SONAR instead of RADAR? How can you 'swap' two numbers in two registers (using ALU), without using 3rd register?
Explain why reversal of phase occurs in a bjt ce amplifier.
Civil Engineering (5086)
Mechanical Engineering (4456)
Electrical Engineering (16639)
Electronics Communications (3918)
Chemical Engineering (1095)
Aeronautical Engineering (239)
Bio Engineering (96)
Metallurgy (361)
Industrial Engineering (259)
Instrumentation (3014)
Automobile Engineering (332)
Mechatronics Engineering (97)
Marine Engineering (124)
Power Plant Engineering (172)
Textile Engineering (575)
Production Engineering (25)
Satellite Systems Engineering (106)
Engineering AllOther (1379)