From 3c774575de0381be496a24fdda376b6bfc505816 Mon Sep 17 00:00:00 2001 From: ayaanfaiz Date: Mon, 19 Sep 2016 15:34:20 +0530 Subject: [PATCH] Strong number To check weather a number is strong or not --- Strong number | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Strong number diff --git a/Strong number b/Strong number new file mode 100644 index 00000000..5a161d75 --- /dev/null +++ b/Strong number @@ -0,0 +1,29 @@ +#include +void strng(int a) +{ + int j=a; + int sum=0; + int b,i,fact=1; + while(a>0) + { + fact=1; + b=a%10; + for(i=1;i<=b;i++) + { + fact=fact*i; + } + a=a/10; + sum=sum+fact; + } + if(sum==j) + printf("%d is a strong number",j); + else + printf("%d is not a strong number",j); +} +void main() +{ + int a; + printf("Enter the number to check"); + scanf("%d",&a); + strng(a); +}