Q1. Write
a
program
to input two integers and find out their sum and check whether they are even or odd
Answers
Answered by
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
Math,
2 months ago
Business Studies,
2 months ago
Physics,
2 months ago
Science,
4 months ago
Social Sciences,
4 months ago
Physics,
10 months ago
Social Sciences,
10 months ago
Math,
10 months ago