Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SoftUni Judge
- Contests
- Submissions
- Feedback
- Administration
- Hello, desislava.topuzakova!
- Log out
- Search
- Home Submissions 23088909
- Solution #23088909 by desislava.topuzakova for problem 03. Characters in Range
- Zero test #1 (Correct answer) Run #223822102 Test #102026
- The zero tests are not included in the final result.
- Expected output:Your output:
- 1
- b c
- 1
- b c
- Time used: 0.045 s
- Memory used: 0.00 MB
- Zero test #2 (Correct answer) Run #223822103 Test #102027
- The zero tests are not included in the final result.
- Expected output:Your output:
- 1
- $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9
- 1
- $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9
- Time used: 0.070 s
- Memory used: 0.00 MB
- Zero test #3 (Correct answer) Run #223822104 Test #102028
- The zero tests are not included in the final result.
- Expected output:Your output:
- 1
- $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B
- 1
- $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B
- Time used: 0.073 s
- Memory used: 0.00 MB
- Test #1 (Correct answer) Run #223822105 Test #102029
- Expected output:Your output:
- 1
- c d e f g h i j k l m n o p q
- 1
- c d e f g h i j k l m n o p q
- Time used: 0.056 s
- Memory used: 0.00 MB
- Test #2 (Correct answer) Run #223822106 Test #102030
- Expected output:Your output:
- 1
- 2 3 4 5 6 7 8
- 1
- 2 3 4 5 6 7 8
- Time used: 0.069 s
- Memory used: 0.00 MB
- Test #3 (Correct answer) Run #223822107 Test #102031
- Expected output:Your output:
- 1
- " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @
- 1
- " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @
- Time used: 0.073 s
- Memory used: 0.00 MB
- Test #4 (Correct answer) Run #223822108 Test #102032
- Expected output:Your output:
- 1
- B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y
- 1
- B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y
- Time used: 0.052 s
- Memory used: 0.00 MB
- Source code
- 1
- package Methods_Exercise;
- 2
-
- 3
- import java.util.Scanner;
- 4
-
- 5
- public class CharactersInRange_03 {
- 6
- public static void main(String[] args) {
- 7
- Scanner scanner = new Scanner(System.in);
- 8
- char symbol1 = scanner.nextLine().charAt(0);
- 9
- char symbol2 = scanner.nextLine().charAt(0);
- 10
- //метод, който отпечатва ред с всички символи от по-малкия (< аски код)
- 11
- printSequenceOfChars(symbol1, symbol2);
- 12
- }
- 13
-
- 14
- private static void printSequenceOfChars(char symbol1, char symbol2) {
- 15
- //проверка от кой символ да започнем
- 16
- if (symbol1 < symbol2) {
- 17
- //започваме от symbol1 до symbol2
- 18
- //a до d -> b c
- 19
- for (char symbol = (char)(symbol1 + 1); symbol < symbol2; symbol++) {
- 20
- System.out.print(symbol + " ");
- 21
- }
- 22
- } else { //symbol1 >= symbol2
- 23
- //започваме от symbol2
- 24
- for (char symbol = (char)(symbol2 + 1); symbol < symbol1; symbol++) {
- 25
- System.out.print(symbol + " ");
- 26
- }
- 27
- }
- 28
-
- 29
- }
- 30
- }
- 31
-
- Created on: 08/10/2021 19:39:36
- Modified on: 22/12/2021 14:19:59
- © 2011-2022 - Open Judge System (OJS) 1.5.20150729.95737d0 - running on Windows. Open source project.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement