my question is how can i make my program not to display any unique combination more that ones?

//*****f04.cpp*****
//Name:
//Date: 02 - 17 - 08


#include <iostream>
using namespace std;


int main ()
{
// #1
int a, b, c;
for (c = 1; c *c <= 100; c++)
{
for (a = 1; a <= 100; a++)
{
for (b = 1; b <= 100; b++)
{
if (c * c == a * a + b * b)
cout << c << ", " << a << " and " << b << endl;
}
}


}

How about for (b = 1; b <= a; b++) ?

Thanks alot! I didn't think that fix would be that easy.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.