21) Define a class to accept values into a 3×3 array and check if it is a special array. An array is a special array if the sum of the even elements = the sum of the odd elements.
Example: A[][]={{ 4 ,5, 6},
{ 5 ,3, 2},
{ 4, 2, 5}};
Sum of even elements = 4+6+2+4+2 =18 and
Sum of odd elements= 5+5+3+5=18
22) Write a program to find the sum of all the elements which lie on either diagonal.
For example, for the matrix shown below, your program should
output 68 = (1 + 6 + 11 + 16 + 4 + 7 + 10 + 13):
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
23)Write a program to accept a word and convert it into lowercase, if it is in uppercase. Display the new word by replacing only the vowels with the letter following it.
Sample Input: computer
Sample Output: cpmpvtfr
24)Write a program to input a string and convert it into uppercase and print the pair of vowels and the number of pairs of vowels occurring in the string.
Input: "BEAUTIFUL BEAUTIES"
Output: Pair of vowels: EA, AU, EA, AU, IE and No. of pair of vowels: 5.
25)Write a program that encodes a word into Piglatin. To translate the word into the Piglatin word, convert the word into uppercase and then place the first vowel of the original word as the start of the new word along with the remaining alphabets. The alphabets present before the vowel is shifted towards the end followed by "AY".
Sample Input 1: London
Output: ONDONLAY
26) Write a program to input a sentence and convert it into uppercase and count and display the total number of words starting with the letter 'A'.
Example:
Sample Input: ADVANCEMENT
AND APPLICATION OF INFORMATION TECHNOLOGY ARE EVER CHANGING.
Sample Output: Total number of words
starting with the letter 'A' = 4
27) Write a program in Java to display the given pattern.
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
28) Write a program in Java to display the given pattern.
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
29) Write a program to display the given pattern.
1
10
101
1010
10101
30) Write a program in Java to display the given pattern.
*
* *
* * *
* * * *
* * * * *