You are on page 1of 1

using

using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;

namespace PitagorinaTrojka
{
class Program
{
static void Main(string[] args)
{
int donjiInterval, gornjiInterval;
int a, b, c;
Console.WriteLine("Uneti intervale");
Console.Write("Donji: ");
donjiInterval = int.Parse(Console.ReadLine());
Console.Write("Gornji: ");
gornjiInterval = int.Parse(Console.ReadLine());
a = donjiInterval; b = donjiInterval; c = donjiInterval;
int brojacMogucnosti = 0;
for (int i = donjiInterval; i < gornjiInterval; i++)
{
for (int j = donjiInterval; j < gornjiInterval; j++)
{
for (int k = donjiInterval; k < gornjiInterval; k++)
{
a = k;
b = j;
c = i;
if (a * a + b * b == c * c)
{
Console.WriteLine(a + "^" + "2" + "+" + b + "^" + "2
" + "=" + c + "^" + "2");
brojacMogucnosti++;
}
}
}
}
Console.WriteLine("\nBroj mogucnosti na zadatom intervalu je: " + br
ojacMogucnosti); Console.WriteLine("ili ako sabirci ne menjaju mesta " + brojacM
ogucnosti / 2);
}
}
}

You might also like