Pascal triangle

#include
using namespace std;

int main()
{
int rows;
cout << "Enter the number of rows : ";
cin >> rows;
cout<<endl;
for (int i = 0; i < rows; i++)
{
int val = 1;
for (int j = 1; j < (rows - i); j++)
{
cout << " ";
}
for (int k = 0; k <= i; k++)
{
cout << " " << val;
val = val * (i - k) / (k + 1);
}
cout << endl;
}
cout << endl;
return 0;
}

cout << "Enter the number of rows : ";
cout<<endl;

hi… just remove these 2 lines from ur code… as they are not expected in the o/p… else ur code is perfect and will pass all test cases after removing these two lines…
directly cin>>rows;

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.