ICSE 2022 SEM-2 QUESTION 6 SOLVED

 /* Define a class to declare an array to accept and store ten words. Display only those words which letter begin with the letter

 * 'A' or 'a' and also end with the letter 'A' or 'a'.

 * Example - Input: Hari, Anita, Akash, Amrita, Alina, Devi, Rishab, John, Farha, AMITHA

 * Output: Anita

 * Amrita

 * Alina

 * AMITHA

 */

import java.util.*;

class QUESTION_6

{

    public static void main(String[]args)

    {

        Scanner sc=new Scanner(System.in);

        String st[]=new String[10];

        System.out.println("Enter 10 words:");

        for(int i=0;i<10;i++)

        {

            st[i]=sc.next();

        }

        System.out.println("Words starting and ending with letter 'a'||'A' are :");

        for(int i=0;i<10;i++)

        {

            char ch=st[i].charAt(0);

            char ch1=st[i].charAt(st[i].length()-1);

            if((ch=='a' || ch=='A') && (ch1=='a' || ch1=='A'))

            System.out.println(st[i]);

        }

    }

}

Second largest number in java using ternary operator

 //Largest second number using ternary operator public class Main { public static void main(String[] args) { int a=5,b=6,c=7; int ...