Tuesday , 24 January 2017
Home » ICSE Important Programs » [Question 5] ICSE 2014 Paper Solved (Special 2-Digit No)

[Question 5] ICSE 2014 Paper Solved (Special 2-Digit No)


A special two-digit number is such that when the sum of the digits is added to the product of its digits, the result is equal to the original two-digit number.

Consider the number 59.Sum of digits = 5+9=14
Product of its digits = 5 x 9 = 45
Sum of the digits and product of digits = 14 + 45 = 59

Write a program to accept a two-digit number. Add the sum of its digits to the product of its digits. If the value is equal to the number input, output the message “special-two digit number” otherwise, output the message “Not a special two-digit number”.

Programming Code:

* The class Special_Q5_ICSE2014 inputs a 2 digit number and
* checks whether it is a Special Two-digit number or not
* @author : www.javaforschool.com
* @Program Type : BlueJ Program - Java
* @Question Year : ICSE 2014 Question 5

import java.io.*;
class Special_Q5_ICSE2014
    public static void main(String args[])throws IOException
            BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
            System.out.print("Enter a 2 digit number : ");
            int n = Integer.parseInt(br.readLine());
            int first, last, sum, pro;
            if(n<10 || n>99) //Checking whether entered number is 2 digit or not
                System.out.println("Invalid Input! Number should have 2 digits only.");
                    first = n/10; //Finding the first digit
                    last = n%10; //Finding the last digit
                    sum = first + last; //Finding the sum of the digits
                    pro = first * last; //Finding the product of the digits
                    if((sum + pro) == n)
                      System.out.println("Output : The number "+n+" is a Special Two-Digit Number.");
                      System.out.println("Output : The number is Not a Special Two-Digit Number.");


1. Enter a 2 digit number : 79
Output : The number 79 is a Special Two-Digit Number.

2. Enter a 2 digit number : 47
Output : The number is Not a Special Two-Digit Number.

Check Also

ICSE 2016 Computer Applications Paper Solved

Download ICSE Computer Applications Question Paper and its Solution. ICSE 2016 Computer Applications Paper Solved


  1. Hi I like programmimg but I’m sometimes unable to understand it any method to help me in this context

  2. This website contains great material ! However, in this particular program, won’t n be changed while operations are performed on it ? If so, won’t I have to copy n to some other variable so that I can compare it ?

  3. Thanks
    It was very helpful
    Keep it up

  4. is the apc publishers good for class x

  5. How to score 100 in comp.. Do u suggest any good books?plz let me know what methods and books I need to adopt..thank u!

  6. Great!loved this website.finding comp ..so much fun.!keep doing the great job! 😀

Leave a Reply to Niharika Cancel reply

Your email address will not be published. Required fields are marked *