Q:

Write a C# program to check the sum of the two given integers and return true if one of the integer is 20 or if their sum is 20

0

Write a C# program to check the sum of the two given integers and return true if one of the integer is 20 or if their sum is 20

Sample Output:

Input an integer:                                                      
25                                                                     
Input another integer:                                                 
20                                                                     
True

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
using System.Collections.Generic;

public class Exercise21 {
  static void Main(string[] args)
        {
         int x, y;
         int result;  
   
         Console.WriteLine("\nInput an integer:");  
         x = Convert.ToInt32(Console.ReadLine());
         Console.WriteLine("Input another integer:");  
         y = Convert.ToInt32(Console.ReadLine()); 
         Console.WriteLine(x == 20 || y == 20 || (x + y == 20));
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now