R

@Ruchirm702

print all the Prime Numbers between 1 and N.

Java
2 years ago
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); for (int i = 2; i <= N; i++) { //since 1 in non-prime boolean isPrime = true;

Prime or not

Java
2 years ago
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int count = 0; for (int i = 1; i <= n; i++) {

Sum Of Odd & Even Digits In A Number

Java
2 years ago
import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) { // YOUR CODE GOES HERE // Please take input and print output to standard input/output (stdin/stdout) // DO NOT USE ARGUMENTS FOR INPUTS // E.g. 'Scanner' for input & 'System.out' for output Scanner sc = new Scanner(System.in);

Factors of n numbers

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i = 1 ; i <= n ; i++){

Sum the digits (T as input.For each test case)

Java
2 years ago
import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) { // YOUR CODE GOES HERE // Please take input and print output to standard input/output (stdin/stdout) // DO NOT USE ARGUMENTS FOR INPUTS // E.g. 'Scanner' for input & 'System.out' for output Scanner sc = new Scanner(System.in);

Given two numbers A & B, print all the numbers from A to B in a single line.

Java
2 years ago
import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) { // YOUR CODE GOES HERE // Please take input and print output to standard input/output (stdin/stdout) // DO NOT USE ARGUMENTS FOR INPUTS // E.g. 'Scanner' for input & 'System.out' for output Scanner sc = new Scanner(System.in);

Write a program to print all odd numbers from 1 to N where you have to take N as input from user.

Java
2 years ago
import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) { // YOUR CODE GOES HERE // Please take input and print output to standard input/output (stdin/stdout) // DO NOT USE ARGUMENTS FOR INPUTS // E.g. 'Scanner' for input & 'System.out' for output Scanner sc = new Scanner(System.in);

Given a number print true if it is palidrome else false

Java
2 years ago
/* pallindrome = 121 = 121 print same as reverse Number will be palindrome if it is equal to its reverse */ import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main {

Given a number , store the reverse of that number in 'int' and then print it (if -ve the print -ve.

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int rev = 0 ;

Given a number , store the reverse of that number ( as positive only ) in 'int' and then print it .

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int rev = 0 ;

Sum of given number using While loop

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int sum = 0 ;