From 83e4427b3eb385982da964f197a3c6dbe7b1204f Mon Sep 17 00:00:00 2001 From: ashish4321 Date: Fri, 25 Aug 2017 21:07:54 +0530 Subject: [PATCH] Add files via upload adding disarm number check --- disarium.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 disarium.c diff --git a/disarium.c b/disarium.c new file mode 100644 index 00000000..290bb7c1 --- /dev/null +++ b/disarium.c @@ -0,0 +1,30 @@ +#include +#include + +int main() +{ + int n,i=0,j,sum=0,l,k; + scanf("%d",&n); + k=n; + j=k; + while(n>0) + { + d=n%10; + n=n/10; + i++; + } + while(k>0) + { + l=k%10; + sum=sum+pow(l,i); + k=k/10; + i--; + } + if(j==sum) + { + printf("It is an disarium number"); + } + else + printf("It is not disarium number"); + return 0; +}