Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to replace this in c# ( scanf("%d",&cond);)
Posted

Here is the exact equivalent of your C code in C#

C#
string input = Console.ReadLine();
int cond;
Int32.TryParse(input, out cond);
 
Share this answer
 
Hi,

Do you want to convert this code in C# in Console

Then
==============
C#
int cond;
object objIn=Console.In.ReadLine();
if(!Int32.TryParse(objIn,out cond))
{
 // If not a proper value
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900