Write a java program to calculate the sum of two even numbers. 

  1. class DMSoperators
  2. {  
  3. public static void main(String [] args)
  4. {
  5. int x= 50;
  6. int y= 60; 
  7. int a= x+y;
  8. if(x%2==0 && y%2==0)
  9. {
  10. System.out.println(a);
  11. }
  12. else
  13. {
  14. System.out.println("It is not an even number");
  15. }
  16. }

Output:

110                                                        
                                                              
                                                              

---------------------xxxxxx---------------------xxxxxxxxxxx----------------------------xxxxxxx--------------------

  1. class DMSoperators
  2. {  
  3. public static void main(String [] args)
  4. {
  5. int x= 50;
  6. int y= 65; 
  7. int a= x+y;
  8. if(x%2==0 && y%2==0)
  9. {
  10. System.out.println(a);
  11. }
  12. else
  13. {
  14. System.out.println("It is not an even number");
  15. }
  16. }

Output:

It is not an even number