I am trying to do an console application. This application allows to user to prompt an input until user prompt the negative numbers. However, after an user typed a number, it terminates automatically. I want that the amount of value can be typed in the application in second time or third time until negative numbers. What is the code to make this in C#?
Kindest Regards

Shaik AliPosted Feb 23, 2010, 12:33 PM
int iInput=0;
do
{
iInput=Int32.Parse(Console.ReadLine(iInput));
}while(iInput>0)
FarukPosted Feb 20, 2010, 3:05 AM
Also you can use this code;
int Number = 0;
while (Number.ToString() != null)
{
try
{
Number = Int32.Parse(Console.ReadLine());
}
catch
{
Console.WriteLine("You should've input a number!");
}
Console.WriteLine(String.Format("Your number is {0}", Number.ToString()));
}
kiran kumarPosted Feb 20, 2010, 3:00 AM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace myfirst
{
class Program
{
static void Main(string[] args)
{
int n;
while (true)
{
n = int.Parse(Console.ReadLine());
if (n < 0)
{
Console.WriteLine("you typed negative no bubbye");
System.Environment.Exit(1);
}
else
{
Console.WriteLine("you enterd a positive no:" + n + "");
}
}
}
}
}
MARK THE ANSWER IF IT HELPS YOU
Kirtan PatelPosted Feb 20, 2010, 2:57 AM
just tell me what do you want to do and what result you need .and how you want to input in strait forward way ..instead of programmatic way..
l
april zoomPosted Feb 20, 2010, 2:53 AM
Kirtan PatelPosted Feb 20, 2010, 2:45 AM
" I want that the amount of value can be typed in the application in second time or third time until negative"