Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Number Star Pattern
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include<iostream>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add question as well in the comments above the code?

using namespace std;
int main(){
int i,j,n,l;
cin>>n;
l=n;
for(i=1;i<=n;i++)
{
for(j=1;j<=(n-i+1);j++)
cout<<j;
if(i>1){
for(j=1;j<=2*(i-1);j++)
cout<<"*";
}
for(j=l;j>=1;j--)
cout<<j;
l--;
cout<<"\n";
}
}