#include
using namespace std;
int main() {
int n,i;
cin>>n;
int val=1;
for( i=0;i<=n;i++)
{
for(int s=n;s>=1;sā)
{
cout<<" ā;
}
for(int j=0;j<=i;j++)
{
cout<<ā "<<val;
val=val*(i-j/j+1);
}
cout<<endl;
}
return 0;
}
Sir ,i try lot of times pls check d error
Hey @suraj1js18cs167
please share ur code in IDE
- go to ide.codingblocks.com
- paste ur code
- press ctrl+s
- click on save
- paste the url here
Hey @suraj1js18cs167
Just saw ur message ,please send ur code here
Also send the correct one
u sent for odd even i guess in chat
hey @suraj1js18cs167
Did changes in ur code and mentioned them in comments
#include <iostream>
using namespace std;
int main() {
int n,i;
cin>>n;
int val=1;
for( i=0;i<n;i++) //did<n here
{
val=1;//added this here
for(int s=n-i;s>=1;s--){ ///did n-i here
cout<<" ";
}
for(int j=0;j<=i;j++)
{
if(j==0){ //added this
cout<<1;
continue;
}
val=val*(i-j+1)/j; //updated this and swapped it above next line
cout<<" "<<val;
}
cout<<endl;
}
return 0;
}