**Click here to download the complete ISC 2014 Computer Science Paper 2 (Practical).**

#### Question:

A Composite Magic number is a positive integer which is composite as well as a magic number.

**Composite number:**

A composite number is a number that has more than two factors.

For example: 10

Factors are: 1, 2, 5, 10

**Magic number:**

A magic number is a number in which the eventual sum of the digits is equal to 1

For example: 28=2+8=10=1+0=1

Accept two positive integers m and n, where m is less than n as user input. Display the number of Composite magic integers that are in the range between m and n (both inclusive) and output them along with the frequency, in the format specified below.

Test your program with the sample data and some random data:

**Example 1:**

**INPUT:**

m = 10

n = 100

**OUTPUT: **

THE COMPOSITE MAGIC INTEGERS ARE:

10, 28, 46, 55, 64, 82, 91, 100

FREQUENCY OF COMPOSITE MAGIC INTEGERS IS: 8

**Example 2:**

**INPUT:**

m = 1200

n = 1300

**OUTPUT: **

THE COMPOSITE MAGIC INTEGERS ARE:

1207, 1216, 1225, 1234, 1243, 1252, 1261, 1270, 1288

FREQUENCY OF COMPOSITE MAGIC INTEGERS IS: 9

**Example 3:**

**INPUT:**

m = 120

n = 99

**OUTPUT: **

INVALID INPUT

#### Programming Code:

/** * The class MagicComposite_ISC2014 inputs two integers and prints all those numbers * which are composite as well as Magic * @author : www.javaforschool.com * @Program Type : BlueJ Program - Java * @Question Year : ISC Practical 2014 Question 1 */ import java.io.*; class MagicComposite_ISC2014 { boolean isComposite(int n) // Function to check for Composite number { int count=0; for(int i=1;i<=n;i++) { if(n%i==0) count++; } if(count>2) return true; else return false; } int sumDig(int n) // Function to return sum of digits of a number { int s = 0; while(n>0) { s = s + n%10; n = n/10; } return s; } boolean isMagic(int n) // Function to check for Magic number { int a = sumDig(n); while(a>9) { a = sumDig(a); } if(a == 1) return true; else return false; } public static void main(String args[])throws IOException { MagicComposite_ISC2014 ob = new MagicComposite_ISC2014(); BufferedReader br=new BufferedReader (new InputStreamReader(System.in)); System.out.print("Enter the lower limit(m) : "); int m=Integer.parseInt(br.readLine()); System.out.print("Enter the upper limit(n) : "); int n=Integer.parseInt(br.readLine()); int c=0; if (m<n) { System.out.println("The Composite Magic Integers are: "); for(int i=m; i<=n; i++) { if(ob.isComposite(i)==true && ob.isMagic(i)==true) { if (c==0) // Printing the first number without any comma System.out.print(i); else System.out.print(", "+i); c++; } } System.out.println("nThe frequency of Composite Magic Integers is : "+c); } else System.out.println("OUT OF RANGE"); } }

#### Output:

Enter the lower limit(m) : 1200

Enter the upper limit(n) : 1300

The Composite Magic Integers are:

1207, 1216, 1225, 1234, 1243, 1252, 1261, 1270, 1288

The frequency of Composite Magic Integers is : 9

Sir, is it possible to get data structures as a practical program for 2016 ISC board?

No

Respected sir/madam….

how do we solve this program..??

A string is said to be “unique”, if none of the alphabets present in the string are repeated.Write a program to accept a string and check whether the string is unique or not.

Sample input:COMPUTER

Sample output:Unique string

sir how to write an algorithm

http://www.guideforschool.com/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical/

Respected Sir/madam

can u please give me some example questions asked in viva

Here you go: http://www.guideforschool.com/1465944-isc-computer-practical-viva-questions/

this program hepled me a lot…

very nice program…

Respected Sir/Maam

In viva the examiner asked me just one question…..What do we use Nested If.

I replied: to implement conditions under the conditions.

is my answer correct

Yes the answer is acceptable.

Hi, I got the output and the viva was also okay…but the external did not ask me to take a printout of the output, so I just took a printout of the program…it is clearly specified in the question paper that the output has to be printed out…I am going to lose marks for this right..? 🙁

It should have been taken out. But if the examiner marked that you have shown the output, and none of your batch mates took printouts of the output then no need to worry. You won’t lose your marks.

mam today the exam was very fantastic thankyou for all of your help through programs and algorithms.i am very grateful to you

grateful to you.

Thnx a lot sir!!

the examiner askd me wat is a modifier. can u please answer??

A modifier is a keyword placed in a class, method or variable declaration that changes how it operates. Examples of modifiers are: abstract, final, static etc.

The external asked me only one question in viva..will he give me 1 or 2 marks out of 20?

No. If you answered it correctly then you will get full marks. If not then around 5 marks or less will be deducted. Relax.