October 6, 2017
Q.No 20 Solution
In below solution we used “ternary operator” which is a compact form of if-else statement. Here is the format of ternary operator:
<test expression> ? (if test expression is true executed this code) : (if test expression is false execute this code)
problem 19 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Drawing; namespace ConsoleApplication6 { class Program { static void Main(string[] args) { int num = 35; Console.WriteLine(num % 5 == 0 && num % 7 == 0 ? 1 : 0); } } }