Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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 ajoutée par Mohannad Bakbouk , Full Stack Web Developer , Almohtaseb
Date de publication: 2016/10/19
Anas Elmadhoon
par 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
par 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

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?