Gcobani Mkontwana

Gcobani Mkontwana

  • 1.3k
  • 513
  • 15.8k

App accepts a number less than 5 and output the diff

Feb 14 2020 6:25 AM
Hi Team
 
I need your help i want to create a console app that accept 5 number and output the diff for that number. My challenge to this is test scenario for user input, please assist thanks.  Below this what i have attempted to solve this, but it i must also find a way to create scenario for test cases and need some help please .
  1. using System;  
  2.                       
  3. public class Program  
  4. {  
  5.     public static void Main()  
  6.     {  
  7.             string[] seperators = {","" "";""."};  
  8.             int num2;  
  9.             Console.WriteLine("Input numbers over 10:");  
  10.   
  11.             string[] splitArray = Console.ReadLine().Split(seperators, StringSplitOptions.RemoveEmptyEntries);  
  12.             foreach (string num in splitArray)  
  13.             {  
  14.   
  15.             if(Int32.TryParse(num, out num2) == true)  
  16.             {  
  17.                 if (num2 < 10)  
  18.                 {  
  19.                     Console.WriteLine(num + " is smaller than 10");  
  20.                 }  
  21.             }  
  22.             else  
  23.             {  
  24.                 Console.WriteLine(num + " is not a f***ing number...");  
  25.             }  
  26.             }  
  27.         }  
  28.       
  29.     }  

Answers (3)