This C# program defines two integer variables, a and b, assigns them values of 2 and 5 respectively. It then prints the values of a and b to the console. It uses a ternary operator to check if a is greater than b, and assigns the greater value to x, then prints x to display the larger of a and b.
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
31 views
rt1 C#
This C# program defines two integer variables, a and b, assigns them values of 2 and 5 respectively. It then prints the values of a and b to the console. It uses a ternary operator to check if a is greater than b, and assigns the greater value to x, then prints x to display the larger of a and b.
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1
class rt1 { public static void Main() { int a=2; int b=5; int x; System.Console.WriteLine("a="+a); System.Console.WriteLine("b="+b); x=(a>b)?a:b; System.Console.