adplus-dvertising
frame-decoration

Question

Select the output for the following set of code :
static void Main(string[] args)
 {
     long  x;
     x = Convert.ToInt32(Console.ReadLine());
     do
     {
         Console.WriteLine(x % 10);
     }while ((x = x / 10) != 0);
     Console.ReadLine();
 }
 enter x = 1234.

a.

number of digits present in x

b.

prints ‘1’

c.

prints reverse of x

d.

prints sum of digits of ‘x’

Answer: (c).prints reverse of x

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Select the output for the following set of code :