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 EvenRangePrinter { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
int first = in.nextInt(); | |
int last = in.nextInt(); | |
if (first<last){ | |
for (int i= first;i<last;i++){ | |
i += 1; |
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 RangeWithStepPrinter{ | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
int first = in.nextInt(); | |
int last = in.nextInt(); | |
int step = in.nextInt(); | |
if(first<last){ | |
if(first<last&&step<0){ |
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 RangePrint { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
int first = in.nextInt(); | |
int last = in.nextInt(); | |
if(first<=last){ | |
for (int i = first; i <= last; i++) { | |
System.out.print(i); |
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
public class MatrixMaxSumRowFinder { | |
public static void main(String[] args) { | |
int[][] matrix = {{1,11,11,1,3}, | |
{1,1,2,1,4}, | |
{4,1,9,1,5}, | |
{1,2,3,4,5,}}; | |
System.out.println("Index of MaxSumRow: "+findMaxSumRow(matrix)); | |
} |
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
public class MatrixAverageCalculator { | |
public static void main(String[] args) { | |
int[][] myArray = new int[4][6]; | |
arrayFiller(myArray); | |
int matrixAvr = calculateAverage(myArray); | |
System.out.println("AVR : " + matrixAvr); | |
} |
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
public class MatrixPrinter { | |
public static void main(String[] args) { | |
int[][] array = new int[4][6]; | |
printMatrix(array); | |
} | |
private static void printMatrix(int[][] matrix) { | |
for (int[] i : matrix) { | |
for (int j : i) |
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.Arrays; | |
public class SequenceArrayCreator{ | |
public static void main(String[] args) { | |
createSequenceArray(5); | |
System.out.println(Arrays.toString(createSequenceArray(5))); | |
} | |
private static int[] createSequenceArray(int size) { | |
if(size<0){ |
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
public class ArrayPositivesCounter { | |
public static void main(String[] args) { | |
int [] array ={-3, 0, -1, 3, -2, 5}; | |
int countPositiveArray = countPositives(array); | |
System.out.println("Positive numbers in array: "+countPositiveArray); | |
} |
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.Arrays; | |
public class ArrayPositiveFinder | |
{ | |
public static void main(String[] args) { | |
int[] array = {-1, 84, 0, -1, 27, -1}; | |
int findFirstPositive = findFirstPositive(array); | |
int findLastPositive = findLastPositive(array); | |
System.out.println(Arrays.toString(array)); |
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.Arrays; | |
public class ArraySumCalculator { | |
public static void main(String[] args) { | |
int[] array = new int[5]; | |
fillArray(array); | |
int sum = sumArray(array); |