bhalash

Project Euler problem #5 solution.

Jun 1st, 2012
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.33 KB | None | 0 0
  1. using System;
  2.  
  3. public class Problem
  4. {
  5.     static void Main()
  6.     {
  7.         int a = 20;
  8.         int b = 0;
  9.  
  10.         while (b <= 0)
  11.         {
  12.             for (int i = 11; i <= 20; i++)
  13.             {
  14.                 if (a % i != 0)
  15.                 {
  16.                     a += 20;
  17.                     break;
  18.                 }
  19.                 else if (i == 20)
  20.                 {
  21.                     b = a;
  22.                     break;
  23.                 }
  24.             }
  25.         }
  26.  
  27.         Console.WriteLine("\n{0}\n", b);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment