if i want to read some integer what command i must use
how to do i read and save value in multi dimensional array??

urgently needed:-|

maybe this short tutorial will help you. Follow the link near the bottom of the page for other tutorials.

maybe this short tutorial will help you. Follow the link near the bottom of the page for other tutorials.

that link is telling how to read from a file I want to know how to read from keyboard.
Like we have have cin command in c++ and scanf in C

If your using a Console app it should be

string strTemp = Console.Readline()

If your using a Console app it should be

string strTemp = Console.Readline()

but i said i wanted to read integer tht will read integer as character

int intTemp = Convert.ToInt32(Console.Readline())

int intTemp = Convert.ToInt32(Console.Readline())

i have also found one other way that is
int n= int.Parse(Console.ReadLine());
thanks pal that is great

Crap forgot that he wanted a integer and not a string. :)

Crap forgot that he wanted a integer and not a string. :)

no prob it is done now thanks for answering;)

hey these codes are working you can debug and use
int sum = 7;
Console.WriteLine("enter an integer for adding");

int a = int.Parse(Console.ReadLine());

sum += a;

Console.WriteLine(sum);

int no=(int)Convert.ToInt32(Console.ReadLine());

this ll also work

must given input in integer without string..how is it possible in c#?suppose user given input in string how can i manage?

Hi Jeya Rani, welcome to DaniWeb.
First: Don't resurrect old threads.
Start a new thread with your question and refer to this thread with a link, if you want to.
To answer you question, try this:

        /// <summary>
        /// Read an integer from the console
        /// Return 0 if no success(perhaps MaxInt?)
        /// </summary>
        /// <param name="prompt">descriptive message</param>
        /// <returns>an integer</returns>
        public int readInt(string prompt)
        {
            Console.Write(prompt);
            string line = Console.ReadLine();
            int quantity;
            if (int.TryParse(line, out quantity) == false)
            {
                quantity = 0;
            }
            return quantity;
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.