I have had the user enter an integer. I would like to test to see if the first digit is a 7 or not.
string enteredValue;
int number;
Console.WriteLine("Enter integer: ");
enteredValue = Console.ReadLine();
The test (to see if the first digit is a 7) can occur before or after I parse the string to an int. If the number is not a 7 have the following occur
Console.WriteLine("First digit was not 7");
Console.WriteLine(nRe-enter number ");
Aucun commentaire:
Enregistrer un commentaire