Write a java program to calculate the sum of two even numbers.
- class DMSoperators
- {
- public static void main(String [] args)
- {
- int x= 50;
- int y= 60;
- int a= x+y;
- if(x%2==0 && y%2==0)
- {
- System.out.println(a);
- }
- else
- {
- System.out.println("It is not an even number");
- }
- }
- }
Output:
110
---------------------xxxxxx---------------------xxxxxxxxxxx----------------------------xxxxxxx--------------------
- class DMSoperators
- {
- public static void main(String [] args)
- {
- int x= 50;
- int y= 65;
- int a= x+y;
- if(x%2==0 && y%2==0)
- {
- System.out.println(a);
- }
- else
- {
- System.out.println("It is not an even number");
- }
- }
- }
Output:
It is not an even number
0 Comments