Hi it's me again now i have another problem i can't figure out what's wrong with my code.. It work's well with lower numbers like 4, 5 but above five the triangle is messed up need help here's the code..I can't get what's wrong with my code????.....
Code:
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "Input num\n";
cin >> n;
cin.ignore();
for (int y = 0; y < n; y++)
{
int k = 1;
cout.width(n-y);
for (int x = 0; x <= y; x++)
{
cout << k << " ";
k = k * (y - x) / (x + 1);
}
cout << "\n";
}
cout << "\n";
cin.get();
}
tnx...