TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maha
NA
0
328.2k
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();
}
}
}
Reply
Answers (
2
)
Control instructions in C#
Variable declaration