M

@marish

Given a number A, print Odd if number is Odd, Otherwise print Even

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; //Given a number A, print "Odd" if number is Odd, Otherwise print "Even". //Note : Print without double quotes(""). // The main method must be in a class named "Main". public class Main {

Output test 2

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". public class Main { public static void fun(int a) { a = a + 10; System.out.print(a); }

Output test 1

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". public class Main { public static void fun(int a) { System.out.println("def"); return;

You are given an integer A find the value of cube of A

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; //You are given an integer A. //You have to find the value of cube of A i.e, A3. // The main method must be in a class named "Main". public class Main { public static void main(String[] a

Given a number A. Return square of the number.

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; //Given a number A. Return square of the number. // The main method must be in a class named "Main". public class Main { public static void main(String[] args) { Scanner scn = new

Given two numbers A & B. Return their product.

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; //Given two numbers A & B. Return their product. // The main method must be in a class named "Main". public class Main { public static void main(String[] args) { Scanner scn = new

Given two numbers A & B. Return their sum.

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; //Given two numbers A & B. Return their sum. // The main method must be in a class named "Main". public class Main { public static void main(String[] args) { Scanner scn = new Sca

Factorial of N ---Feb 2024

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; //Factorial of N ---Feb 2024 // The main method must be in a class named "Main". public class Main { public static void main(String[] args) { // System.out.println("Hello world!");

Given an array A, check if it is sorted in non-decreasing order or not.

Java
2 years ago
/*public class Solution { public int solve(ArrayList<Integer> A) { } } */ /*Given an array A, check if it is sorted in non-decreasing order or not. Non-decreasing order means that the numbers in a sequence can stay the same or increase, but

program reads array n modifies array by shifting each element to the right by one position

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; //Write a program that reads an integer array A from input and modifies the array by shifting each element to the right by one position and by shifting the last element to the first position.

array min max value to find

Java
2 years ago
// 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 import java.lang.*; import java.u

Write a program to print sum of elements of the input array A of size N.

Java
2 years ago
import java.lang.*; import java.util.*; /*Write a program to print sum of elements of the input array A of size N. Note: the size element is removed from the list passed as input to the function main, that is only elements are present. User is supp

Given two numbers A & B. Return their sum.

Java
2 years ago
/*Given two numbers A & B. Return their sum. */ import java.util.* ; import java.lang.* ; import java.io.* ; public class Main{ public static void main(String[] args) { Scanner scn = new Scanner(System.in); int A = scn.nextInt(); int

Thank you Lord bless Thee Father

Java
2 years ago
/*Given a number A. Return square root of the number if it is perfect square otherwise return -1. Note: A number is a perfect square if its square root is an integer. */ import java.util.* ; public class Main { public static void main(String[

Tern_ary opera_tor sample program in java

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