Răspuns :
Răspuns:
In C++
Ex. 1)
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int P,a,b,i;
a=1;
b=2;
P=1;
for(i=1;i<=100;i++)
{
P=P*(a+pow(b, 2));
a++;
b++;
}
cout<<P;
}
Ex.2) Obs: Singurele numere pitagorice citite consecutiv sunt 5,4 si 3
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int a,b,c,n;
for(n=1;n<=100;n++)
{
a=n;
b=n+1;
c=n+2;
if(pow(a,2)==pow(b,2)+pow(c,2))
{
cout<<a<<b<<c;
}
if(pow(b,2)==pow(a,2)+pow(c,2))
{
cout<<b<<a<<c;
}
if(pow(c,2)==pow(b,2)+pow(a,2))
{
cout<<c<<b<<a;
}
}
}
Ex. 2) Program testat: