Created
June 2, 2016 10:24
-
-
Save amantix/6a3121da8e6ce33aa8d80a6e71e5e4ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace FirstApp | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Hello world!"); | |
int n=175; | |
//PrintDivisors(n); | |
int k = 65; | |
int v=GCD(n, k); | |
//Console.WriteLine(v); | |
//for(int x=0; x<2; ++x) | |
// for(int y=0; y<2; ++y) | |
// for(int z=0; z<2; ++z) | |
// for (int w = 0;w < 2; ++w) | |
// Console.WriteLine((x%2 != 0) && (y%2 != 0) || (z%2!=0) && (w % 2 != 0)); | |
int count = 0; | |
for(int x1=0; x1<10; ++x1) | |
for(int x2=0; x2<10; ++x2) | |
for (int x3 = 0; x3 < 10; ++x3) | |
for (int x4 = 0; x4 < 10; ++x4) | |
for (int x5 = 0; x5 < 10; ++x5) | |
for (int x6 = 0; x6 < 10; ++x6) | |
if (x1 + x2 + x3 == x4 + x5 + x6) | |
count++; | |
Console.WriteLine(count); | |
} | |
static int GCD(int n, int k) | |
{ | |
while (n > 0 && k > 0) | |
{ | |
if (n > k) | |
n = n%k; | |
else | |
k = k%n; | |
} | |
if (n > 0) | |
return n; | |
return k; | |
} | |
private static void PrintDivisors(int n) | |
{ | |
int d = 1; | |
while (d <= n) | |
{ | |
if (n%d == 0) | |
Console.WriteLine(d); | |
d = d + 1; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment