Question
import java.util.Scanner; Public class PrimeNumber { public static void main(String args[]) { int number boolean isPrime=true; Scanner scan= new Scanner(System.in); System.out.println(Enter any number:); //capture the
import java.util.Scanner; Public class PrimeNumber { public static void main(String args[]) { int number boolean isPrime=true; Scanner scan= new Scanner(System.in); System.out.println("Enter any number:"); //capture the input in an integer int num=scan.nextInt(); for(int i=2;i
import java.util.Scanner;
public class SimpleCalculator
{
public static void main(String[] args) {
Scanner reader = new Scanner(System.in); System.out.print("Enter two numbers: ");
// nextDouble() reads the next double from the keyboard double num1 = reader.nextDouble(); double num2 = reader.nextDouble();
System.out.print("Enter an operator (+, -, *, /): "); char operator = reader.next().charAt(0);
float result;
switch(operator) { case '+': result = num1 + num2; break;
case '-': result = num1 - num2; break;
case '*': result = num1 * num2; break;
case '/': result = num1 / num2; break;
} System.out.printf("%.1f %c %.1f = %.1f", num1, operator,num2, result); } }
import java.util.Scanner; public class RSAPubilcKey { public static void main(String[] args) { Scanner in = new Scanner(System.in); int cases =in.nextInt(); for (int i = 0;i } } if (pp && qq) { long n = p*q; long totient = (p - 1) * ( q - 1); if ((1 else { System.out.printf("Invalid e for RSA Key! "); } } } } import java.util.Scanner; public class FizzBuzz { public static void main(String args[]) { Scanner in = new Scanner(System.in); int n; Scanner n = in.nextInt; for (int i=1; i else if (i%3==0) System.out.print("Fizz"+" "); else System.out.print(" "); } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started