Calling Parameterized Method

Java : Calling Parameterized Method Program List




Program [1]

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 x digit1 + 2 x digit2 + 3 x digit3 + 4 x digit4  + 5 x digit5  + 6 x digit6  + 7 x digit7 + 8 x digit8  + 9 x digit9 + 10 x digit10 is divisible by 11.

Example: 

For an ISBN 1401601499

Sum=1 x 1 + 2 x 4 + 3 x 0 + 4 x 1 + 5 x 6 + 6 x 0 + 7 x 1 + 8 x 4 + 9 x 9 + 10 x 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".



View Solution


Program [2]

A prime palindrome integer is a positive  integer  (without  leading  zeros)  which  is  prime  as  well as a palindrome. Given two positive integers m and n, where m < n, write a program to determine how many  prime-palindrome integers  are  there  in  the  range  between  m  and  n  (both inclusive) and output them.

The input contains two positive integers  m  and  n  where  m  <  3000  and  n  <  3000.  Display  the number of prime-palindrome integers in the specified range along with their values in the format specified below:

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

Example 1

INPUT: m = 100 n = 1000

OUTPUT: THE PRIME PALINDROME INTEGERS ARE:

101, 131, 151, 181, 191, 313, 353, 373, 383, 727, 757, 787, 797, 919, 929

FREQUENCY OF PRIME PALINDROME INTEGERS : 15

Example 2

INPUT: m = 100 n = 5000

OUTPUT: OUT OF RANGE


View Solution


CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad