Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Select the output for the following set of code?

        static void Main(string[] args)

        {

            int a =5, b =;

            if (Convert.ToBoolean(Convert.ToInt(++a)) || Convert.ToBoolean(Convert.ToInt(++b)))

            {

                Console.WriteLine(a + "\\n" + b);

            }

            else

                Console.WriteLine(" C# ");

 

        }

user-image
Question added by Mohannad Bakbouk , Full Stack Web Developer , Almohtaseb
Date Posted: 2016/10/19
Anas Elmadhoon
by Anas Elmadhoon , Full Stack Asp.net Web Developer , Freelancer

Appear error says: Invalid expression term from b=;

"b" needs to init value.

 

Thank you so much for invitation for answer.

Anas

Mohammad Nadir Roshan
by Mohammad Nadir Roshan , Technical Support Specialist , FreeBalance Co

There are three major problem with code.

1. "Invalid term expression": meaning the variable 'b' need to be initialized (given a value).

2. "Convert.ToInt" is not recognized in C# and it should be "Convert.ToInt"

3. "\\n" is not correct to get a new line and it should have only one backslash

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.