Maha

Maha

  • NA
  • 0
  • 311.9k

Comparison Operators

Dec 6 2011 12:16 PM
This program is compiling well but if I have an alternative expression (which is mathematically correct) not compiling. Expression is shown in the comment out statement.

That means (gpa >= 3.0 && test >= 60) || (gpa < 3.0 && test >= 80) is correct for compiler

(gpa => 3.0 && test => 60) || (gpa < 3.0 && test => 80) wrong for compiler

Could anyone can explain the reason?


using System;

namespace ConsoleApplication1
{
class Admission
{
static void Main(string[] args)
{
double gpa, test;
string x;

Console.Write("Enter Grade Point Average ");
x = Console.ReadLine();
gpa = Convert.ToDouble(x);

Console.Write("Enter Test Score ");
x = Console.ReadLine();
test = Convert.ToDouble(x);

if ((gpa>=3.0 && test>=60) || (gpa<3.0 && test>=80)) //(gpa=>3.0 && test=>60) || (gpa<3.0 && test=>80)
Console.WriteLine("ACCEPT");
else
Console.WriteLine("REJECT");

Console.ReadKey();
}
}
}


Answers (2)