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

Write An Expression That Prints “Special Number” If Specialnum Is -99, 0, or 44. We have prepared an extensive article on this topic. We are happy to make you students happy.

Guide Content

## 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. Answers;

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.

## 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++ – the answers are listed above.

## 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. We have prepared the best possible answers for you. Thank you and we look forward to your comments.

Write An Expression That Prints “Special Number” If Specialnum Is -99, 0, or 44. We have come to the end of our answer. It would be our pleasure to share your views.

You may interested: