java program to Input an integer and check whether it is a special number or not.

Programming Example

WAP to Input an integer and check whether it is a special number or not.

A special number is such a number whose sum of the factorials of each digit is the number itself. For example, 145 is a special number because 1! + 4! + 5! = 1 + 24 +120 = 145. Special numbers are also called factorion.

Solution

class SpecialNumber
{
	public static void main(String arr[])
	{
		int i,j,r,d;
		for(i=100;i<=999;i++)
		{
			r=0;
			for(j=i;j>0;j=j/10)
			{
				d=j%10;
				r=r*10+d;
			}
			if(r==i)
				System.out.println(i);
		}
	}
}
Output

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad