Aliendreamer

firstquestion Maria

Sep 3rd, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2.  
  3. namespace SliceFiles
  4. {
  5.     using System.Collections.Generic;
  6.     using System.Linq;
  7.  
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             List<int> results=new List<int>();
  13.  
  14.             for (int i = 1; i <7; i++)
  15.             {
  16.                 for (int j = 1; j <7; j++)
  17.                 {
  18.                     for (int k = 1; k <7; k++)
  19.                     {
  20.                         int currentroll = i + j + k;
  21.                         results.Add(currentroll);
  22.                     }
  23.                 }
  24.                
  25.             }
  26.  
  27.  
  28.      
  29.  
  30.             int totalPermutations = results.Count;        
  31.             int resultForNine = results.Count(x => x == 9);
  32.             int resultForTen = results.Count(x => x== 10);
  33.  
  34.             Console.WriteLine("Ten is presented in {0}, Nine is presented in {1}, total permutations are {2}"
  35.                                 ,resultForTen,resultForNine,totalPermutations);
  36.  
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment