Find even number between two number.

 14. Find even number between two number.


package com.company;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
// write your code here
Scanner sc = new Scanner(System.in);
int fist , second , evenN;
System.out.println("To find even number between two number ");
System.out.print("First number : ");
fist= sc.nextInt();
System.out.print("Second number : ");
second= sc.nextInt();
for (int i=1; i<=second;i++)
{
if (i%2==0)
{
System.out.print(i+" ");
}
}
}
}
To find even number between two number 
First number : 13
Second number : 65
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 
Process finished with exit code 0



Comments

Popular posts from this blog

the distance between two cities (in km is input through the keyboard. write a program to convert and print this distance in meter ,feet inches and centimeter.

CREATE UNIT CONVERTER APP

write a program to check whether a triangle is valid or not, when the threeangles of the triangle are entered through the keyboard. A triangle is valid if the sumof all the three angles is equal to 180 degrees