Răspuns:
#include <iostream>
using namespace std;
void print(int a, int b, int c)
{
cout << "("<< a << "," <<b<<","<<c<<")"<< "\n";
}
bool triunghi(int a, int b, int c)
{
if (a+b>c && a+c>b && b+c>a) return true;
else return false;
}
int main()
{
int a, b, c;
cin >> a;
if (a==0) cout << "nu exista";
else
{
cin >> b;
if (b==0) cout << "nu exista";
else
{
cin >> c;
if (c==0) cout << "nu exista";
else
{
int triplet=0;
if (triunghi(a,b,c)) {print(a,b,c); ++triplet;}
int num;
cin >> num;
while (num)
{
a=b;
b=c;
c=num;
if (triunghi(a,b,c)) {print(a,b,c); ++triplete;}
cin >> num;
}
if (triplet==0)
cout << "nu exista";
}
}
}
return 0;
}