This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.nio.charset.Charset; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.util.stream.Stream; | |
/* | |
* Write a program to read a text file "Input.txt" holding a sequence of integer numbers, | |
* each at a separate line. Print the sum of the numbers at the console. | |
* Ensure you close correctly the file in case of exception or in case of normal execution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Class_01_RectangleArea { | |
public static void main(String[] args) { | |
Scanner console = new Scanner(System.in); | |
System.out.print("a = "); | |
int a = Integer.parseInt(console.next()); | |
System.out.print("b = "); | |
int b = Integer.parseInt(console.next()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
class VladkosNotebook | |
{ | |
static void Main() | |
{ | |
SortedDictionary<string, Dictionary<string, dynamic>> notebook | |
= new SortedDictionary<string, Dictionary<string, dynamic>>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text.RegularExpressions; | |
/* | |
* Write a program that reads a string from the console and replaces all series | |
* of consecutive identical letters with a single one. | |
*/ | |
class SeriesOfLetters | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
// Write a program that reads a string from the console, reverses it | |
// and prints the result back at the console. | |
class ReverseString | |
{ | |
static void Main(string[] args) | |
{ | |
char[] charArr = Console.ReadLine().ToCharArray(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/* | |
* Write two programs that fill and print a matrix of size N x N. | |
* Filling a matrix in the regular pattern (top to bottom and left to right) is boring. | |
* Fill the matrix as described in both patterns below | |
* Example 1: | |
* 1 6 11 16 21 | |
* 2 7 12 17 22 | |
* 3 8 13 18 23 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/* | |
* Write a method GetMax() with two parameters that returns the larger of two integers. | |
* Write a program that reads 2 integers from the console and prints the largest of them | |
* using the method GetMax(). | |
*/ | |
class BiggerNumber |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
/* | |
*Write a program to sort an array of numbers and then print them back on the console. | |
*The numbers should be entered from the console on a single line, separated by a space. | |
*/ | |
class SortArrayOfNumbers | |
{ |