Guest User

Custom method

a guest
Dec 24th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. public OutputClass GetOutput(InputClass input)
  2. {
  3.     OutputClass output = new OutputClass();
  4.  
  5.     double sum = 0;
  6.  
  7.     foreach (double val in input.tubeValues)
  8.     {
  9.         if (val % 2 == 0)
  10.         {
  11.             output.warningsCards.Add("Divisible by 2!");
  12.         }
  13.  
  14.         if (val % 3 == 0)
  15.         {
  16.             output.warningsTubes.Add("Divisible by 3!");
  17.         }
  18.  
  19.         sum += val;
  20.     }
  21.  
  22.     output.result = sum.ToString();
  23.  
  24.     return output;
  25. }
Add Comment
Please, Sign In to add comment