usingMaths.com
Demonstrating and showing pupils and students one application of Mathematics.







<< PreviousNext >>

Collecting input for H.C.F. (G.C.D.) Code in C#



Collecting Input in C#.

Let's add some input mechanism so our user enters the set of numbers whose H.C.F. we are to find.


The C# H.C.F. (G.C.D.) code

All we need is a main C# code that asks the user for input.
For this purpose, we'll use the Console.ReadLine() library function.

How to use the code

The user gets to enter his/her choice of numbers.
After entering each number, the user presses <Enter>.
After the user has entered every of his/her numbers, the user enters the word done to see the result.


Note: You can comment out the C# code for the main class from the previous lesson if you have been following.










<< PreviousNext >>