Computer Science, asked by divyansh8960, 10 months ago

Question 4:
(15)
Write a program in java to enter a number and check whether it is a special number
(Krishnamurthy number) or not.
A number is said to be a special number if sum of factorial of digits of a number is
equal to the number itself.​

Answers

Answered by sweet33mona
3

hey mate here is your answer

I am not writting the starting .so write it by yourself

int n=28,sum=0;

for(int i=1;i<=n/2;i++)

{

if(n%i==0)

{

sum=sum+i;

}

}

if(sum==0)

System.out.println("It is perfect or special number");

else

System.out.println (" It is not");

}

}

you can take the number by the user too by using Scannet class.

Hope it helps and if you like it plz mark as brainliest...

Regards Ayush..

Similar questions