-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestion95_PrintLetters.java
More file actions
52 lines (35 loc) · 954 Bytes
/
Question95_PrintLetters.java
File metadata and controls
52 lines (35 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package week6_String;
import java.util.Scanner;
public class Question95_PrintLetters {
public static void main(String[] args) {
// olcay // Jul 8, 2020
/* Write a program that will print out letters in the alphabetic order accordingly to the given range within 2 chars.
Example:
input: A
input: Z
output: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Example:
input: a
input: f
output: abcdef
Example:
input: a
input: d
output: abcd
Example:
input: B
input: O
output: BCDEFGHIJKLMNO
*/
Scanner scan = new Scanner(System.in);
System.out.println("Enter the start letter: ");
char start = scan.next().charAt(0);
System.out.println("Enter the end letter: ");
char end = scan.next().charAt(0);
String dummy="";
for(char c=start; c<=end; c++ ) {
dummy=dummy+c;
}
System.out.println(dummy);
}
}