#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int row, col, n;
cout<< "Enter Integer Number : ";
cin>> n;
for(row = 1; row <= n; row++){
for(col = 1; col <= row; col++){
cout<< " " << char(col+64) ;/// char(col+96) it's return small letter
};
cout<<endl;
};
getch();
}
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int row, col, n;
cout<< "Enter Integer Number : ";
cin>> n;
for(row = 1; row <= n; row++){
for(col = 1; col <= row; col++){
cout<< " " << char(row+64) ;/// char(row+96) it's return small letter
};
cout<<endl;
};
getch();
}
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int row, col, n;
cout<< "Enter Integer Number : ";
cin>> n;
for(row = 1; row <= n; row++){
for(col = 1; col <= row; col++){
cout<< " " << (col%2) ;
};
cout<<endl;
};
getch();
}
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int row, col, n;
cout<< "Enter Integer Number : ";
cin>> n;
for(row = 1; row <= n; row++){
for(col = 1; col <= row; col++){
cout<< " " << (row%2) ;
};
cout<<endl;
};
getch();
}
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
while (true)
{
int row, col, n;
cout<< "Enter N : ";
cin>> n;
for (row = 1; row <= n; row++){
for(col = 1; col <= row; col++)
{
cout<< "* ";
}
cout << endl;
}
for (row = n-1; row >= 1; row--)
{
for (col = 1; col <= row; col++)
{
cout<< "* ";
}
cout<< endl;
}
}
return 0;
getch();
}
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int col, row, n;
cout<<"Enter Number : ";
cin>> n;
/*
1
1 2
1 2 3
*/
for (row = 1; row <= n; row++){
for (col = 1; col <= row; col++){
cout<< " "<<col;
}
cout<<endl;
}
/*
1 2 3
1 2
1
*/
for (row = (n-1); row >= 1; row--){
for (col = 1; col <= row; col++){
cout<<" "<<col;
}
cout<<endl;
}
getch();
}
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
while(true){
int n, col, row;
cout<< "Enter N : ";
cin>> n;
for (row = 1; row <= n; row++)
{
//Printing spaces
for (col = 1; col <= n-row; col++)
{
cout<< " ";
};
//Printing star
for (col =1; col <= 2*row-1; col++){
cout<< "* ";
};
cout<< endl;
}
}//End while loop
getch();
}
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
while(true){
int n, col, row;
cout<< "Enter N : ";
cin>> n;
for (row = 1; row <= n; row++)
{
//Printing spaces
for (col = 1; col <= n-row; col++)
{
cout<< " ";
};
//Printing star
for (col =1; col <= 2*row-1; col++){
cout<< "* ";
};
cout<< endl;
}
///Reverse Pyramid
for (row = n-1; row >= 1; row--)
{
//Printing spaces
for (col = 1; col <= n-row; col++)
{
cout<< " ";
};
//Printing star
for (col =1; col <= 2*row-1; col++){
cout<< "* ";
};
cout<< endl;
};
}//End while loop
getch();
}
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int row, col, n;
cout<< "Enter Integer Number : ";
cin>> n;
for(row = n; row >= 1; row--){
for(col = 1; col <= row; col++){
cout<< " " << row;
};
cout<<endl;
};
getch();
}
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
while(1){
int n, col, row;
cout<<"Enter Number : ";
cin>>n;
for (row = 1; row <= n; row++)
{
///spacing
for (col = 1; col <= n-row; col++)
{
cout<< " ";
}
///number
for (col = 1; col <= row; col++)
{
cout<<char(col+64) ;//col
}
cout<< endl;
}
}
getch();
}
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int rows,columns,i,j;
cout<<"Enter the number of rows : ";
cin>>rows;
cout<<"Enter the number of columns : ";
cin>>columns;
for (i=1; i<=rows; i++){
for (j=1; j<=columns; j++){
if(i==1||i==rows||j==1||j==columns){
cout<<"*";
}else{
cout<<" ";
}
}
cout<<endl;
}
return 0;
}