0

Having problems running this code. I can't figure out where error lies

using System; namespace Project { class MyClass { public static void Main(string[] args) { int age; string name; string answer = "Fine"; string answer1 = "fine"; Console.WriteLine("What is your name"); name = Convert.ToString(Console.ReadLine()); Console.WriteLine("Hey..." + name); Console.WriteLine("How are you doing today"); answer = Convert.ToString(Console.ReadLine()); answer1 = Convert.ToString(Console.ReadLine()); if (answer1 == fine){ Console.WriteLine("Nice hearing that"); } else { Console.WriteLine("Sorry for whatever happened"); Console.WriteLine("I hope it would be fine!"); } if (answer == Fine) { Console.WriteLine("Nice!"); } else { Console.WriteLine("Sorry, I hope it would be fine"); } age = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("How old are you" + name); Console.ReadKey(); if (age < 18) { Console.WriteLine("Sorry" + name + "You are not old enough"); } else if (a

5th Oct 2021, 9:38 AM
omitogun toni
omitogun toni - avatar
1 Answer
0
You can use code playground to save code and share link here.. In code , in conditions answer1==fine and answer==Fine , Fine , and fine are not defined once. You may mean answer1=="fine" and answer=="Fine" . For string comparision ,use equal method as answer1.Equals("fine") edit: one question is different from other. . others can't find it unless you told. https://www.sololearn.com/discuss/2897587/?ref=app
5th Oct 2021, 12:19 PM
Jayakrishna 🇼🇳