Sunday, 22 August 2010

source code for using if in c#

//source code for using if in c#
using System;
class IfDemo
{
static void Main()
{
int x, y;
Console.Write("Enter x value: ");
x = int.Parse(Console.ReadLine());
Console.Write("Enter y value: ");
y = int.Parse(Console.ReadLine());
if (x > y)
Console.WriteLine("x is greater");
else if(x < y) Console.WriteLine("y is greater"); else Console.WriteLine("Both are equal"); } }

No comments:

Post a Comment