Users Pricing

forum

Home Forums Write another function for this code using C# – MindStick

Write another function for this code using C#

E E Cummings 2729 05 Oct 2013
using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string numberIn;
            int numberOut;

            numberIn = Console.ReadLine();

            while (!int.TryParse(numberIn, out numberOut) || numberOut < 0)
            {
                Console.WriteLine("Invalid. Enter a number that's 0 or higher.");
                numberIn = Console.ReadLine();
            }
        }
    }
}

1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md