What do you want to save?
Add Code snippet
New code examples
-
Java 2022-03-26 13:40:11
generate all prime number less than n java
/** Author: Jeffrey Huang As far as I know this is almost the fastest method in java for generating prime numbers less than n. A way to make it faster would be to implement Math.sqrt(i) instead of i/2. I don't know if you could implement sieve of eratost... Add solution -
Java 2022-03-19 12:55:14
how to have multiple conditions in an if statement java
//Program to check if the answer to the given question is correct //with multiple conditions in a single else if statement import java.util.Scanner; public class MultipleChoiceQuestion { public static void main(String args[]) { String question... Add solution -
Java 2022-03-17 02:05:01
java accept 2 integers from the user, and using a method add these numbers and print the result
static void M1(int num1, int num2) { int sum = num1 + num2; System.out.println("sum of " + num1 + " and " + num2+ " = " + sum); } public static void main(String[] args) { // using Methods... Add solution -
Java 2022-03-16 10:40:07
how to make a calculator in java
// this was all coded by me, to use it get Eclipse, or IntelliJ and make a new // Java Project package javaCode; import java.util.Scanner; public class testCode { public static void main(String[] args) { Scanner scan = new Scanner(System.in); ... Add solution -
Java 2022-03-13 05:10:26
how to use scanners in java
import java.util.Scanner; // import scanner Scanner myScanner = new Scanner(System.in); // Make scanner obj String inputString = myScanner.nextLine(); // Take whole line boolean inputBoolean = myScanner.nextBoolean(); //Boolean input long inputLong ... 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 -
Other 2022-03-11 10:35:02
take input from user in java using scanner
import java.util.*; class UserInputDemo { public static void main(String[] args) { Scanner sc= new Scanner(System.in); //... Add solution
Best helpers
Ranking is empty