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

IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?

0 Answers  


Is oop better than procedural?

0 Answers  


write a c++ code to overload + and - for a stack class such that + provides push and - provides pop operation

1 Answers   College School Exams Tests, HCL, IBM, TCS,


What is encapsulation example?

0 Answers  


What is a null tree?

0 Answers  


What is the purpose of polymorphism?

0 Answers  


#include <iostream> using namespace std; struct wow { int x; }; int main() { wow a; wow *b; a.x = 22; b = &a; a.x = 23; cout << b->x; return 0; }

1 Answers  


What are functions in oop?

0 Answers  


What is the real life example of polymorphism?

0 Answers  


How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction

0 Answers  


class type to basic type conversion

0 Answers  


Is following functions are said to be overloaded? int add(int a,int b) char *add(int a,int b)

4 Answers  


Categories