Page 1 :
Friday, August 20, 2021, 9:07 AM, , COMBINED ICSE 246 Page 1
Page 5 :
class armstrong, {, int temp,r,s=0;, void main(int n), {, temp=n;, while(n>0), {, r=n%10;, s=s+r*r*r;, n=n/10;, }, if(s==temp), System.out.println("Armstrong number");, else, System.out.println("not Armstrong number");, }, }, , COMBINED ICSE 246 Page 5
Page 7 :
class palindrome, {, int rev=0,r,temp;, void main(int n), {, temp=n;, while(n!=0), {, r=n%10;, rev=rev*10+r;, n=n/10;, }, if(rev==temp), System.out.println("Palindrome number");, else, System.out.println("not a Palindrome number");, }, }, , class spyy, {, int r,s=0,p=1;, void main(int n), {, while(n!=0), {, r=n%10;, s=s+r;, p=p*r;, n=n/10;, }, if(s==p), System.out.println("Spy number");, else, System.out.println("not a Spy number");, }, }, , COMBINED ICSE 246 Page 7
Page 9 :
(a) Analyse the following program segment and determine how many times the loop will be, executed and what will be the output of the program segment ?, int p= 200;, while(true), {, if(p<100), break;, p=p-20;, }, System.out.println(p);, , Question 5:, The International Standard Book Number (ISBN) is a unique numeric book identifier which is printed, on every book. The ISBN is based upon a 10-digit code. The ISBN is legal if:, 1 × digit1 + 2 × digit2 + 3 × digit3 + 4 × digit4 + 5 × digit5 + 6 × digit6 + 7 × digit7 + 8 × digit8 + 9 ×, digit9 + 10 × digit10 is divisible by 11., , E×ample : For an ISBN 1 4 0 1 6 0 1 4 9 9, , Sum = 1×1 + 2×4 +3×0 + 4×1 + 5×6 + 6×0 + 7×1 + 8×4 + 9×9 + 10×9 = 253 which is divisible by 11., Write a program to :, (i) Input the ISBN code as a 10-digit integer., (ii) If the ISBN is not a 10-digit integer, output the message, “Illegal ISBN” and terminate the program., (iii) If the number is 10-digit, extract the digits of the number and compute the sum as explained, above., If the sum is divisible by 11, output the message, “Legal ISBN”. If the sum is not divisible by 11, output, the message, “Illegal ISBN”., , COMBINED ICSE 246 Page 9
Page 10 :
Question 5:, A special two-digit number is such that when the sum of its digits is added to the product of its, digits, the result is equal to the original two-digit number. Example: Consider the number 59., Sum of digits = 5 + 9=14, Product of its digits = 5 x 9 = 45, Sum of the sum of 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 2-digit number”, otherwise, output the message “Not a special 2-digit number”., , Question 8:, Write a program to accept a number and check and display whether it is a Niven number or not. [15], (Niven number is that number which is divisible by its sum of digits)., COMBINED ICSE 246 Page 10
Page 11 :
(Niven number is that number which is divisible by its sum of digits)., Example:, Consider the number 126., Sum of its digits is 1+2+6 = 9 and 126 is divisible by 9., , COMBINED ICSE 246 Page 11
Page 12 :
Write a program to input a number and check and print whether it is a Pronic number or not., (Pronic number is the number which is the product of two consecutive integers), Examples : 12 = 3 × 4 ., 20 = 4 × 5, 42 = 6 × 7, , A tech number has even number of digits. If the number is split in two equal halves, then the, square of sum of these halves is equal to the number itself. Write a program to generate and print, all four digit tech numbers., Example :, Consider the number 3025, Square of sum of the halves of 3025 = (30+25), = (55), = 3025 is a tech number., , COMBINED ICSE 246 Page 12