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