Computer Science, asked by roselyn19, 4 months ago

Q1. Write
a
program
to input two integers and find out their sum and check whether they are even or odd​

Answers

Answered by himanshu2006vps
0

Answer:

import java.util.Scanner;

public class EvenOdd {

public static void main(String[] args) {

Scanner reader = new Scanner(System.in);

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

int num = reader.nextInt();

int a= reader.nextInt();

int b = reader.nextInt()

num= a+b;

System.out.println("Sum="+num);

{

if(num % 2 == 0)

System.out.println(num + " is even");

else

System.out.println(num + " is odd");

}

}

}

Similar questions