Computer_Assignments_X_SET-2
Computer_Assignments_X_SET-2
Assignments
Set-2
Q3. Write a program in java to enter a String/Sentence and display the longest
word and the length of the longest word present in the string.
Q4. Write a program using method name Glcm(int, int) to find the lowest
common Multiple(LCM) of two numbers. GCD of two integers is calculated by
continued division method. Divide the larger number by the smaller, the
remainder then divides the previous divisor. The process is repeated till the
remainder is zero. The divisor then results in the GCD.
LCM=product of two numbers/GCD
Q6. Write a menu driven program to generate the upper case letters from Z to A
and lower case letters from ‘a’ to ‘z’ as per user’s choice. Enter ‘1’ to display
upper case letters from Z to A and enter ‘2’ to display lower case letters from a
to z.
Q7.Write a program to input and store roll numbers, names and marks in 3
subjects of n number of students in five single dimensional arrays and display
the remark based on average marks as given below:
Average Marks Remark
85-100 Excellent
75-84 Distinction
60-74 First Class
40-59 Pass
Less than 40 Poor
Q8. Write a program to input two numbers and check whether they are twin
prime numbers or not.
Hint: Twin prime numbers are the prime numbers whose difference is 2.
For example: (5,7),(11,13)…. and so on…
Q9. Write a program to display all the numbers between 100 and 200
which don’t contain zeros at any position.
*****************************************************************************