Decode School

Decode School - The School for Problem Solvers
Welcome to My Blog.
Need Assignment / Project Guidance (or) Training in Python?

Java Program to print English Alphabets between two Alphabets

Get two alphabets and print the alphabets lies between them.

Sample Input 1:

D H

Sample Ouput 1:

D E F G H

Program or Solution

					    
							
import java.util.*;
class Alies
{
    public static void main(String args[])
    {
        char i;
	char start,stop;
        Scanner sc=new Scanner(System.in);	
        System.out.println("Enter Two Alphabets:");
	start=sc.next().charAt(0);
        stop=sc.next().charAt(0);
	System.out.println("The Output Is:");
	for(i=start;i<=stop;i++)
	  {
		System.out.print(" "+i);
	  }
    }
}
					    
					

Program Explanation

set variable as starting letter of given input Print increament varible Till end of given string.