taks kamps

taks kamps

  • NA
  • 39
  • 6.8k

Logical and relational expressions

Dec 1 2018 5:33 AM
a should be true if i and j are not equal or j is greater than k
b should be true if j is middle of the three values or if all values are equal
  1. using System;  
  2. namespace HelloWorld  
  3. {  
  4. class Program  
  5. {  
  6. static void Main(string[] args)  
  7. {  
  8. bool a, b;  
  9. int i = 1;  
  10. int j = 2;  
  11. int k = 3;  
  12. a = i!=j && j>k;  
  13. b = i > j || j < k && i == j;  
  14. Console.Write(a + ", " + b);  
  15. }  
  16. }  
  17. }  

Answers (1)