Home ICSE Computer Applications Class 10 – Previous Year Question Papers & Solutions / Programs / Define a class to declare a character array of size ten. Accept the characters into the array and display the characters with highest and lowest ASCII (American Standard Code for Information Interchange) value.EXAMPLE :INPUT:'R', 'z', 'q', 'A', 'N', 'p', 'm', 'U', 'Q', 'F'OUTPUT :Character with highest ASCII value = zCharacter with lowest ASCII value = A
🚀 Programming Example

Define a class to declare a character array of size ten. Accept the characters into the array and display the characters with highest and lowest ASCII (American Standard Code for Information Interchange) value.
EXAMPLE :
INPUT:
'R', 'z', 'q', 'A', 'N', 'p', 'm', 'U', 'Q', 'F'
OUTPUT :
Character with highest ASCII value = z
Character with lowest ASCII value = A

👁 67 Views
💻 Practical Program
📘 Step Learning
Learn this program step-by-step with algorithm, source code, output and detailed explanation.
No previous program
No next program

📌 Information & Algorithm

Given Input:


Expected Output:


💻 Program Code

import java.util.Scanner;

public class RansariASCIIVal
{

    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        char ch[] = new char[10];
        int len = ch.length;
        
        System.out.println("Enter 10 characters:");
        for (int i = 0; i < len; i++)
        {
            ch[i] = in.nextLine().charAt(0);
        }
        
        char h = ch[0];
        char l = ch[0];
        
        for (int i = 1; i < len; i++)
        {
            if (ch[i] > h)
            {
                h = ch[i];
            }
            
            if (ch[i] < l)
            {
                l = ch[i];
            }
        }

        System.out.println("Character with highest ASCII value: " + h);
        System.out.println("Character with lowest ASCII value: " + l);
    }

}
                        
No previous program
No next program
📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.