2
Answers

Comparison Operators

Maha

Maha

13y
1.4k
1
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)