NUMBER
NUMBER
OUTPUT:
USER LOGIN LOGOUT DURATION
IDENTIFICATION TIME & DATE TIME & DATE HOURS:MINS
149 20:10 20-12 2:50 21-12 6:40
173 12:30 20-12 12:30 21-12 24:00
142 16:20 20-12 16:30 20-12 00:10THE USER WHO LOGGED IN FOR
THE LONGEST DURATION:
173 12:30 20-12 12:30 21-12 24:00
7. 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>=100 and n<= 3000.
Display 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,351,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
8. An ISBN (International Standard Book Number) is a ten digit code which uniquely
identifies a book.
The first nine digits represent the group, publisher and title of the book and the last digit is
used to check whether ISBN is correct or not.
Each of the first nine digits of the code can take a value between 0 to 9. Sometimes it is
necessary to make the last digit equal to ten. This is done by writing the last digit of the code
as X.
To verify an ISBN, calculate 10 times the first digit, plus 9 times the second digit, plus 8
times the third digit and so on until we add 1 time the last digit. If the final number leaves no
remainder while divided by 11, the code is a valid ISBN
For example:
0201103311=10*0+9*2+8*0+7*1+6*1+5*0+4*3+3*3+2*1+1*1=55
This is a valid ISBN
007462542X=10*0+9*0+8*7+7*4+6*6+5*2+4*5+3*4+2*2+1*10=176
This is a valid ISBN
Similarly 0112112425 is not a valid ISBN.
Test Data:
Input code: 0201530821
Output: Sum=99
Leaves no remainder – valid ISBN
Input code: 356680324
Output: Sum=invalid input
Input code: 0231428031
Output: Sum=122
Leaves remainder – invalid ISBN
9. Write a program to input two valid dates, each comprising of day (2 digit) month (2 digit)
and year (4 digit) and calculate the day elapsed between the two dates.
Test your program with following data values:
Example:
First date: Day: 24
Month : 09
Year : 1960
Second Date: Day: 10
Month: 12
Year: 1852First date: Day: 10
Month : 01
Year : 1952
Second Date: Day: 16
Month: 10
Year: 1952
10. A Circular Prime is a prime number that remains prime under cyclic shifts of its digits.
When the leftmost digit is removed and replaced at the end of the remaining string of
digits, the generated number is still prime. The process is repeated until the original
number is reached again.
Example:
131
311
113
Hence, 131 is a circular prime.
Accept a positive number N and check whether it is a circular prime or not. The new
numbers formed after the shifting of the digits should also be displayed.
Test your program with the following data and some random data:
Example 1
INPUT:
N = 197
OUTPUT:
197
971
719
197 IS A CIRCULAR PRIME.
Example 2
INPUT:
N = 1193
OUTPUT:
1193
1931
9311
3119
1193 IS A CIRCULAR PRIME.
Example 3
INPUT:
N = 29
OUTPUT:
29
92
29 IS NOT A CIRCULAR PRIME.
*********************************