What do you want to save?
Add Code snippet
New code examples
-
Java 2022-03-17 15:10:39
usaco why did the cow cross the road iii silver java
//sample input 3 3 3 2 2 2 3 3 3 3 2 3 3 2 3 3 3 2 2 2 3 //CODE (2021/1/18) YY/MM/DD import java.util.*; import java.io.*; public class Main { static field[][] farm; public static void main(String[] args) throws Exception { Scanner sc = new S... Add solution -
Java 2022-03-11 17:50:03
armstrong numbers problem java
// Java program to print all armstrong numbers between given range import java.util.Scanner; public class ArmstrongNumbersGivenRange { public static void main(String[] args) { int number, startNumber, endNumber, a, rem, n, count = 0; S... Add solution -
Java 2022-03-11 11:35:19
Java program to print prime numbers from 2 to n
// Java program to print prime numbers from 2 to n import java.util.Scanner; public class PrimeNumberFrom2Ton { public static void main(String[] args) { int loop, max; System.out.print("Please enter highest (maximum) number: "... Add solution -
Java 2022-03-02 20:05:28
Java program find GCD and LCM of two numbers using euclid’s algorithm
import java.util.Scanner; public class GCDLCMEuclid { // gcd java void findGCD(long num1, long num2) { while(num2 > 0) { long temp = num2; num2 = num1 % num2; num1 = temp; } System.out.printl... Add solution -
Java 2022-03-01 04:40:02
Java program to find average of n numbers
// Java program to find average of n numbers import java.util.Scanner; public class FindAverageOfNNumbers { public static void main(String[] args) { int num, count = 1; float a, average, total = 0; Scanner sc = new Scanner(S... Add solution -
Java 2022-02-22 20:10:19
Multiply two numbers without using arithmetic operators in java
import java.util.Scanner; public class MultiplyWithoutArithmeticOperators { static int multiplyNumber(int num1, int num2) { int output = 0; boolean boolNegative = (num1 < 0 && num2 >= 0) || (num2 < 0 && num1 >... Add solution -
Java 2022-02-16 02:00:11
Java program convert decimal to octal using while loop
import java.util.Scanner; public class DecimalToOctalUsingWhileLoop { public static void main(String[] args) { int decimal; Scanner sc = new Scanner(System.in); System.out.println("Please enter decimal number: "); d... Add solution -
Java 2022-02-01 12:05:03
Java program to check if it is a sparse matrix
import java.util; public class SparseMatrix { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Please enter dimensions of sparse matrix: "); int x = sc.nextInt(); int... Add solution -
Java 2022-02-01 06:51:33
read lines of file randomly java
import java.io.*; import java.util.*; public class GetLine { public static void main(String[] args) throws FileNotFoundException { System.out.println("Random Line : "+randomLine()); } public static void randomLine() throws FileNotFoun... Add solution -
Java 2022-02-01 06:50:15
Display even and odd numbers in java using for loop
import java.util.Scanner; public class FindEvenOrOdd { public static void main(String[] args) { int a; Scanner sc = new Scanner(System.in); System.out.println("Please enter a number to check even or odd: "); a = sc.... Add solution