Input:
enter the value:1234
output:
1
2
3
4
write a program to get above output.....

Answers were Sorted based on User's Feedback



Input: enter the value:1234 output: 1 2 3 4 write a program to get above output.......

Answer / mahesh.b.p.c

static void Main(string[] args)
{
string value= Console.ReadLine();
foreach(object num in value)
{
Console.WriteLine(num);
Console.WriteLine();
}
Console.Read();

}

Is This Answer Correct ?    11 Yes 4 No

Input: enter the value:1234 output: 1 2 3 4 write a program to get above output.......

Answer / arunbabu.k

static void Main(string[] args)
{
Console.WriteLine("Enter text/numbers");
string str1=Console.ReadLine();
char[] ch_str = new char[str1.Length];
ch_str = str1.ToCharArray();
for (int num = 0; num < str1.Length;num ++ )
{
Console.WriteLine(ch_str [num]);
}
Console.Read();
}

Is This Answer Correct ?    4 Yes 2 No

Input: enter the value:1234 output: 1 2 3 4 write a program to get above output.......

Answer / chandan

public static void Main()
        {
            string str = Console.ReadLine();
            foreach (var obj in str)
            {
                Console.Write(obj.ToString());
                Console.WriteLine();
            }
            Console.ReadLine();
        }

Is This Answer Correct ?    1 Yes 0 No

Input: enter the value:1234 output: 1 2 3 4 write a program to get above output.......

Answer / bala

static void Main(string[] args)
{
string value = Console.ReadLine();
foreach (var num in value)
{
Console.Write(num + " ");
}
Console.Read();

}

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More OOPS Interview Questions

What is difference between #define and const?

3 Answers   emc2,


what is the 3 types of system development life cycle

0 Answers  


Write a program to accept a number and to print numbers in pyramid format? for eg:for a no. 5 1 212 32123 4321234 543212345

7 Answers  


What are the advantanges of modularity

2 Answers  


monkey starts climbing up a tree 20ft tall,each hour ,it hops 3ft and slips back by 2ft .how much time it wil tak to reach top of the tree?

13 Answers   IonIdea,






create a class complex having real and imaginary part of a complex no. as a data member. overload the binary operators(+,- and *) to perform the operations on complex no. objects. overload binary operator using friend function.

2 Answers   CTS, Delhi University,


Why is destructor used?

0 Answers  


which structured data type is not used in c++? 1.union 2.structure 3.string 4.boolean

2 Answers   HCL, Wipro,


What makes a language oop?

0 Answers  


There are two base class B1,B2 and there is one class D which is derived from both classes, Explain the flow of calling constructors and destructors when an object of derived class is instantiated.

0 Answers  


why to use template classes in c++?

1 Answers  


What are the features of oop?

0 Answers  


Categories