Hi, I got to share with you the HackerRank All Java solutions in this post section. I will share all the hacker-rank Java solutions From beginning to end. Also, I will provide the code with a solution. I hope you will learn from this Interesting code journey. We are selling these quotes, not copy-paste. It is for only learning where you can check where you are mistaken. Just find the mistakes after seeing these quotes and then solve your problems. All these Codes are only for educational purposes only.
- HackerRank Welcome to Java Challenge Solution
- HackerRank Java Stdin and Stdout I Solution
- HackerRank Java If-Else Solution
- Even or not Solution
- Area and Perimeter Solution
- Fahrenheit and Celsius Solution
- Sum and Difference of x and y
- Area and Perimeter 5
- Fahrenheit and Celsius
- Add Last Digits
- Greater than 100 or not
- Sum is less than 150 or not.
- xyzw
- Even or not
- Adult or not 1
- High Sum or Low Sum
HackerRank Welcome to Java Challenge Solution
public class Solution { public static void main(String[] args) { /* Enter your code here. Print output to STDOUT. Your class should be named Solution. */ System.out.println("Hello, World."); System.out.println("Hello, Java."); } }
HackerRank Java Stdin and Stdout I Solution
import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int a=sc.nextInt(); int b=sc.nextInt(); int c=sc.nextInt(); System.out.println(a); System.out.println(b); System.out.println(c); } }
HackerRank Java If-Else Solution
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution { private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int N = scanner.nextInt(); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); scanner.close(); if(N%2 == 0) { if(N>=2 && N<=5) { System.out.println("Not Weird"); } else if(N>=6 && N<=20) { System.out.println("Weird"); } else { System.out.println("Not Weird"); } } else { System.out.println("Weird"); } } }
Even or not Solution
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc = new Scanner(System.in); int x= sc.nextInt(); System.out.println(x%2==0); } }
Area and Perimeter Solution
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args){ Scanner scn = new Scanner(System.in); int length = scn.nextInt(); int breadth = scn.nextInt(); int area= length*breadth; int perimeter = 2* (length + breadth); System.out.println(area); System.out.println(perimeter); } }
Fahrenheit and Celsius Solution
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc = new Scanner(System.in); double f = sc.nextDouble(); double c = (f-32)*5/9; System.out.println(c); } }
Sum and Difference of x and y
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int x= scn.nextInt(); int y= scn.nextInt(); System.out.println(x+y); System.out.println(x-y); } }
Area and Perimeter 5
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args){ Scanner scn = new Scanner(System.in); int length = scn.nextInt(); int breadth = scn.nextInt(); int area= length*breadth; int perimeter = 2* (length + breadth); System.out.println(area); System.out.println(perimeter); } }
Fahrenheit and Celsius
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc = new Scanner(System.in); double f = sc.nextDouble(); double c = (f-32)*5/9; System.out.println(c); } }
Add Last Digits
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner scn = new Scanner(System.in); int x= scn.nextInt(); int y= scn.nextInt(); System.out.println((x%10) + (y%10)); } }
Greater than 100 or not
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc = new Scanner(System.in); int x= sc.nextInt(); System.out.println(x>100); } }
Sum is less than 150 or not.
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc = new Scanner(System.in); int x= sc.nextInt(); int y= sc.nextInt(); int z= sc.nextInt(); int sum= x+y+z; System.out.println(sum<150); } }
xyzw
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc = new Scanner(System.in); int x= sc.nextInt(); int y= sc.nextInt(); int z= sc.nextInt(); int w = sc.nextInt(); System.out.println((x*y)==(z*w)); } }
Even or not
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc = new Scanner(System.in); int x= sc.nextInt(); System.out.println(x%2==0); } }
Adult or not 1
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner scn = new Scanner (System.in); int age = scn.nextInt(); if(age>=18){ System.out.println("Adult"); }else{ System.out.println("Below age"); } } }
High Sum or Low Sum
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner scn= new Scanner(System.in); int x = scn.nextInt(); int y = scn.nextInt(); int sum = x+y; if(sum >=100){ System.out.println("High Sum"); } else{ System.out.println("Low Sum"); } } }