ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Select the output for the following set of code?

  1. static void Main(string[] args)
  2. {
  3. int i = 5;
  4. for (; Convert.ToBoolean(Convert.ToInt(i)); Console.WriteLine(i--)) ;
  5. Console.ReadLine();
  6. }

a)b)c)1d)

user-image
تم إضافة السؤال من قبل Mohannad Bakbouk , Full Stack Web Developer , Almohtaseb
تاريخ النشر: 2016/10/20
Mohammad Riyazuddin
من قبل Mohammad Riyazuddin , Web Developer , PYD, King Saud University

Output : 5

               4

               3

               2

               1

 

Explanation: Initial value of i is 5 , the "i" value will be converted as boolean and going to check the condition with that boolean value.,as the iteration part is concerned it displays the values of  "i" and decrement it's counter  until i becomes 0 then loop will terminate.

 

mohammed hussamuddin hussamuddin
من قبل mohammed hussamuddin hussamuddin , C Technical Lead , Infosys

Console.ReadLine will unable to read any data because the for condition check evaluate to false initially so no out put.

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟