1,105,242 Community Members

how to read integer value in c#?

Member Avatar
shadowrider
Newbie Poster
20 posts since Feb 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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:-|

Member Avatar
Ancient Dragon
Achieved Level 70
27,571 posts since Aug 2005
Reputation Points: 5,231 [?]
Q&As Helped to Solve: 3,028 [?]
Skill Endorsements: 115 [?]
Team Colleague
Featured
Sponsor
 
0
 

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

Member Avatar
shadowrider
Newbie Poster
20 posts since Feb 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
blacklocist
Junior Poster in Training
87 posts since Apr 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 2 [?]
Skill Endorsements: 0 [?]
 
0
 

If your using a Console app it should be

string strTemp = Console.Readline()

Member Avatar
shadowrider
Newbie Poster
20 posts since Feb 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
campkev
Posting Pro in Training
484 posts since Jul 2005
Reputation Points: 0 [?]
Q&As Helped to Solve: 19 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
shadowrider
Newbie Poster
20 posts since Feb 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
blacklocist
Junior Poster in Training
87 posts since Apr 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 2 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Question Answered as of 7 Years Ago by blacklocist, campkev and Ancient Dragon
Member Avatar
shadowrider
Newbie Poster
20 posts since Feb 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

no prob it is done now thanks for answering;)

Member Avatar
adem87
Light Poster
25 posts since Aug 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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);

Member Avatar
sanjeevib
Newbie Poster
1 post since Aug 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
1
 
int no=(int)Convert.ToInt32(Console.ReadLine());

this ll also work

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article