Thursday, September 6, 2018

Pattern -4 Part3 video

#include<iostream>
#include<conio.h>
using namespace std;
main()
{
int num; // To input number of lines
cout<<"Enter Number "; cin>>num;
int r,c; char ch;
for(r=1; r<=num; r++) {
for(int sp=1;sp<r;sp++)
cout<<" ";
for( ch='A',c=1 ; c<=num-r+1;ch++, c++)
{
cout<<ch; // will print * in a single line
}
cout<<"\n"; // At end of inner loop next line will
// come in a new line
}
getch();
}

No comments:

Post a Comment