Computer Science, asked by goutam20, 1 year ago

write a program to check a Krishnamurthy Number

Answers

Answered by anugyasoni
3
this is a c program to check whether a number is krishnamurthy number or not...

#include<stdio.h>

#include<conio.h>

void main()

{

int j,i,x,sum=1,k=0,num,n;

clrscr();

printf("Enter a Number");

scanf("%d",&n);

num=n;

while(num>0)

 {x=num%10;

 sum=1;

for(i=x;i>=1;i--)

{sum=sum*i;}

k=k+sum;

num=num/10;

}

if(n==k)

 printf("%d is a Krishnamurthy Number",n);

else

 printf("("%d is not a Krishnamurthy Number ", n);

getch();

}
I JUST HOPE THAT THIS WILL HELP U

Similar questions