Computer Science, asked by suhridsarkarofficial, 27 days ago

write a program in Java to enter two numbers, find their sum and check that the sum is an even number or odd number.​

Answers

Answered by samarthkrv
2

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

 System.out.print("Enter a number:");

 Scanner sc = new Scanner(System.in);

 int x = sc.nextInt();

 System.out.print("Enter another number:");

 int y = sc.nextInt();

 int sum = x + y;

     if(x%2 == 0)

         {

             System.out.println("The sum is even and the sum is " + sum);

         }

     else    

         {

             System.out.println("The sum is odd and the sum is " + sum);

         }

}

}

Explanation:

Similar questions