Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void main()
- {
- int num, temp, rem, fact, i, sum;
- printf("This is a simple program to check Strong Number.\n\n");
- printf("Enter a number : ");
- scanf("%d", &num);
- temp = num;
- sum = 0;
- while(temp != 0)
- {
- rem = temp % 10;
- fact = 1;
- for(i = 1; i <= rem; i++)
- {
- fact = fact * i;
- }
- sum = sum + fact;
- temp = temp / 10;
- }
- if(sum == num)
- {
- printf("%d - is a Strong Number.", num);
- }
- else
- {
- printf("%d - is not a Strong Number.", num);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement