Std XII Computer Science
Total Page:16
File Type:pdf, Size:1020Kb
J.H. TARAPORE SCHOOL WORKSHEET NO- 5 STD XII :A/B/C COMPUTER SCIENCE (2020-2021) Topic : Java Practical Programs General Instructions: • Give the program name as “yournameQ1” eg : “SamikshaQ1,Samiksha Q2” • Execute the programs in your laptop. • Save the program and output together in a Microsoft Word File. • Submit the pendrive on the first day of the school reopening. Question 1. Write a program to check whether the given number is a Prime Adam Number or Not. Prime Number:A number which has only two factors,i.e 1 and the number itself. Adam Number : The square of a number and the square of its reverse are reverse to each other.Example,if n=31 and reverse of n=13,then 312=961 and 132= 169,which is reverse of 961.Thus ,31 is an Adam Number. So, 31 is a Prime Adam Number. Question 2. Write a program to check whether the given number is a Evil Number or Not. An Evil number is a positive whole number which has even number of 1’s in its binary equivalent. Example: Binary equivalent of 9 is 1001, which contains even number of 1’s. Thus, 9 is an Evil Number. A few Evil numbers are 3, 5, 6, 9.... Question 3. Write a program to check whether the given number is a Smith Number or Not. A Smith Number is a composite number,the sum of the digits of a number is equal to the sum of the digits of its prime factors (excluding 1). Example: 666 Prime factors of 666 : 2,3,3 and 37. (2+3+3+3+7)=18 666=6+6+6=18 Thus,666 is a Smith Number. Question 4. Write a program to check whether the given number is a Odious Number or Not. An Odious number is a positive whole number which has odd number of 1’s in its binary equivalent. Example: Binary equivalent of 8 is 1000, which contains odd number of 1’s. Thus, 8 is an Odious Number. A few Odious numbers are 1,2,4,7,8,... Question 5. Write a program to check whether the given number is a GoldBach Number or Not. A GoldBach number is a positive even integer that can be expressed as the sum of two odd primes.So,all even integers greater than 4 are GoldBach numbers. Example : Input: n = 10 Output: Prime Pairs are 5,5(5+5=10) 3,7(3+7=10) .