Pages

Tuesday, 17 July 2018

EvenOdd function in Java for selenium Interview


import java.util.Scanner;

public class EvenorOdd{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println("Enter a number which you want to check whether is even or odd");
int n = in.nextInt();

if(n%2==0){
System.out.println(n+" is an even number.");
}else{
System.out.println(n+" is an odd number."); 
}
}
}
Expected Output
1
2
3
Enter a number which you want to check whether  is even or odd
 4
 4 is an even number.

*************************************************

API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API

 
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes

 
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html

 
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux

 
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign


Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java


GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT


Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions

No comments:

Post a Comment