fork download
  1. /*Write a C program to find Strong Numbers from 0 to 1000.
  2. */
  3. #include<stdio.h>
  4. int main(){
  5. int pro=1,sto,sum=0,count=0,sto2;
  6. for(int i=0;i<=1000;i++){
  7. sto=i;
  8.  
  9. while(sto!=0){
  10. pro=1;
  11. int digit =sto%10;
  12.  
  13. for(int j=1;j<=digit;j++){
  14. pro=pro*j;
  15. }
  16. sto=sto/10;
  17. sum=sum+pro;
  18.  
  19. }
  20. if(sum==i){
  21. count++;
  22. printf("%d ",i);
  23. }
  24. }
  25. printf("\n%d",count);
  26.  
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
0 1 
2