# Free Answer: Special Number İf Specialnum İs -99, 0, or 44.

Write An Expression That Prints “Special Number” If Specialnum Is -99, 0, or 44. We wrote all the answers for you. We are always at your service with our expert team.

Content List

## Write An Expression That Prints “Special Number” İf Specialnum İs -99, 0, or 44.

Write An Expression That Prints “Special Number” İf Specialnum İs -99, 0, or 44. Details below:

This program checks whether a number is a Special Number or not. A number is said to be special number when the sum of factorial of its digits is equal to the number itself.

Example- 145 is a Special Number as 1!+4!+5!=145.

• Program-
• import java.util.*;
• public class SpecialNumberCheck
• {
• public static void main(String args[])
• {
• Scanner ob=new Scanner(System.in);
• System.out.println(“Enter the number to be checked.”);
• int num=ob.nextInt();
• int sum=0;int temp=num;
• while(temp!=0)
• {
• int a=temp%10;int fact=1;
• for(int i=1;i<=a;i++)
• {
• fact=fact*i;
• }
• sum=sum+fact;
• temp=temp/10;
• }
• if(sum==num)
• {
• System.out.println(num+” is a Special Number.”);
• }
• else
• {
• System.out.println(num+” is not a Special Number.”);
• }
• }
• }

Description:

The program checks if the number is a Special Number. Enter the number via the Scanner class. Sum is a variable that stores the sum of the factorial of the digits. Get a temporary variable. The while loop calculates the sum of the factorial of the digits.

Calculate the factorial of the last digit in the loop and add it to the total. Since we have our own factorial for each digit, divide the temperature variable by 10 each time ‘real’ is initialized to 1 each time. So you get the last digit followed by the second last digit and so on.

If sum equals number then the resultant statements are printed.

## Write An Expression That Prints “Special Number” İf Specialnum İs -99, 0, Or 44. Coursehero

Write An Expression That Prints “Special Number” If Specialnum Is -99, 0, Or 44. Coursehero = No Need! Here are the necessary answers.

## Write An Expression That Prints “Special Number” İf Specialnum İs -99, 0, or 44. C++

Write An Expression That Prints “Special Number” If Specialnum Is -99, 0, or 44. C++ topic is mentioned above. You can find other articles in our article.

## Java Write An Expression That Prints “Special Number” İf Specialnum İs -99, 0, or 44.

This program checks whether a number is a Special Number or not.

A number is said to be special number when the sum of factorial of its digits is equal to the number itself.

• Example- 145 is a Special Number as 1!+4!+5!=145.
• Program-
• import java.util.*;
• public class SpecialNumberCheck
• {
• public static void main(String args[])
• {
• Scanner ob=new Scanner(System.in);
• System.out.println(“Enter the number to be checked.”);
• int num=ob.nextInt();
• int sum=0;int temp=num;
• while(temp!=0)
• {
• int a=temp%10;int fact=1;
• for(int i=1;i<=a;i++)
• {
• fact=fact*i;
• }
• sum=sum+fact;
• temp=temp/10;
• }
• if(sum==num)
• {
• System.out.println(num+” is a Special Number.”);
• }
• else
• {
• System.out.println(num+” is not a Special Number.”);
• }
• }
• }

Description-

The program checks if the number is Special Number. We input the number through Scanner class and sum is variable which stores the sum of factorial of digits. A temp variable is taken. The while loop calculates the sum of factorial of digits.

Inside the loop factorial of last digit is calculated and added to the sum. Every time ‘fact’ is initialized to 1 as for every digit we have its own factorial. the variable temp is divided by 10 each time so that we can get last digit and then second last digit and so on.

If sum equals number then the resultant statements are printed. If you have any further questions on this topic, let us know in the comments.

You may interested: