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
I am perparing for DMRC Jr. Engineer Post. Please post me reference book Name At my Id laxman.negi@gmail.com
what is pla instruction
How WDM works in wireless system...as we say that it works in optical and signals transmitted in this are light signals...??
Define fan-in and fan-out?
What are the applications of fm transceiver.
Name the equipments required for 2+2+2.
regarding bsnl jto examination,can i use the printout of application format mentioned in the advertisement.
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."..........
Explain in details how you would react to an unexpected incident when your supervisor or manager is not around to give instructions?
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.
What is the main drawback of a dual slope adc?
objective questions & answers in c & c++ software languages
how can I pass ccna in first try in one month
What is intrinsic semiconductor ?
What are the differences between combinational circuits and sequential circuits?