Write a C# Sharp program to check if y is greater than x, and z is greater than y from three given integers x,y,z.
using System; public class Program { public static void Main(string[] args) { // Get the three integers from the user. Console.Write("Enter the first integer: "); int x = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter the second integer: "); int y = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter the third integer: "); int z = Convert.ToInt32(Console.ReadLine()); // Check if y is greater than x, and z is greater than y. if (y > x && z > y) { // If both conditions are true, print "y is greater than x, and z is greater than y". Console.WriteLine("y is greater than x, and z is greater than y"); } else { // If either condition is false, print "y is not greater than x, or z is not greater than y". Console.WriteLine("y is not greater than x, or z is not greater than y"); } } }
Write a C# Sharp program to check if y is greater than x, and z is greater than y from three given integers x,y,z.
Reviewed by Bhaumik Patel
on
9:37 PM
Rating: