Q) Print K letter Pattern using C++ Program
=> Program :
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
cout<<"\n\n*****************************\n\n\n";
for(int i=1; i<=n;i++){
cout<<"* ";
for(int j=i; j<=n-1; j++){
if(j==n-1){
cout<<"* ";
}else{
cout<<" ";
}
}
cout<<endl;
}
for(int i=1; i<=n-1;i++){
cout<<"* ";
for(int j=2; j<=i; j++){
cout<<" ";
}
cout<<"* ";
cout<<endl;
}
}
Comments
Post a Comment