1234
1234
1234
1234
#include <iostream>
using namespace std;
int main(){
int n;
int a = 1;
cout<<"Enter the number:- ";
cin>>n;
while(a<=n)
{
int j = 1;
while(j<=n){
cout<<j;
j++;
}
cout<<endl;
a++;
}
}
2)
654321
654321
654321
654321
654321
654321
#include <iostream>
using namespace std;
int main(){
int n;
int a = 1;
cout<<"Enter the number:- ";
cin>>n;
while(a<=n)
{
int j = 1;
while(j<=n){
cout<<n-j+1;
j++;
}
cout<<endl;
a++;
}
}
3)
12345
678910
1112131415
1617181920
2122232425
#include <iostream>
using namespace std;
int main(){
int n;
int a = 1;
int k = 1;
cout<<"Enter the number:- ";
cin>>n;
while(a<=n)
{
int j = 1;
while(j<=n){
cout<<k;
j++;
k++;
}
cout<<endl;
a++;
}
}
4)
X
XX
XXX
XXXX
XXXXX
#include<iostream>
using namespace std;
int main(){
cout<<"enter the number";
int a;
cin>>a;
int i =1;
while(i<=a){
int j = 1;
while(j<=i){
cout<<"X";
j++;
}
cout<<endl;
i++;
}
}
5)
#include<iostream>
using namespace std;
int main(){
cout<<"enter the number";
int a;
cin>>a;
int i =1;
while(i<=a){
int j = 1;
while(j<=i){
cout<<i;
j++;
}
cout<<endl;
i++;
}
}
5)
#include<iostream>
using namespace std;
int main(){
cout<<"enter the number";
int a;
cin>>a;
int i =1;
int count = 1;
while(i<=a){
int j =1;
while(j<=i){
cout<<count;
j++;
count++;
}
cout<<endl;
i++;
}
}
6)
#include<iostream>
using namespace std;
int main(){
cout<<"enter the number";
int a;
cin>>a;
int i =1;
while(i<=a){
int j =1;
int val = i;
while(j<=i){
cout<<val;
val++;
j++;
}
cout<<endl;
i++;
}
}
7)
#include<iostream>
using namespace std;
int main(){
cout<<"enter the number";
int a;
cin>>a;
int i =1;
// 2
while(i<=a){
int j =0;
while(j<i){
cout<<j+i << " ";
j++;
}
cout<<endl;
i++;
}
}
8)
#include<iostream>
using namespace std;
int main(){
cout<<"enter the number";
int a;
cin>>a;
int i =1;
// 2
while(i<=a){
int j =0;
while(j<i){
cout<<i-j << " ";
j++;
}
cout<<endl;
i++;
}
}
9)
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
6 5 4 3 2 1
7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1
11 10 9 8 7 6 5 4 3 2 1
12 11 10 9 8 7 6 5 4 3 2 1
13 12 11 10 9 8 7 6 5 4 3 2 1
14 13 12 11 10 9 8 7 6 5 4 3 2 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
#include<iostream>
using namespace std;
int main(){
cout<<"enter the number";
int a;
cin>>a;
int i =1;
// 2
while(i<=a){
int j =0;
while(j<i){
cout<<i-j << " ";
j++;
}
cout<<endl;
i++;
}
}
10)
#include<iostream>
using namespace std;
int main(){
cout<<"enter the number";
int a;
cin>>a;
int i =1;
// 2
while(i<=a){
int j =1;
while(j<=i){
cout<<(i-j+1)<< " ";
j++;
}
cout<<endl;
i++;
}
}
11)
Enter the number you want to print 4
A A A A
B B B B
C C C C
D D D D
#include<iostream>
using namespace std;
int main(){
int a;
cout<<"Enter the number you want to print ";
cin>>a;
int row = 1;
while(row<=a){
int col =1;
while(col<= a){
char ch = 'A' + row-1;
cout<<ch<<" ";
col++;
}
cout<<endl;
row++;
}
}
12)
Enter the number you want to print 4
A B C D
A B C D
A B C D
A B C D
#include<iostream>
using namespace std;
int main(){
int a;
cout<<"Enter the number you want to print ";
cin>>a;
int row = 1;
while(row<=a){
int col =1;
while(col<= a){
char ch = 'A' + col- 1;
cout<<ch<<" ";
col++;
}
cout<<endl;
row++;
}
}
13)
Enter the number you want to print 4
A B C D
E F G H
I J K L
M N O P
#include<iostream>
using namespace std;
int main(){
int a;
cout<<"Enter the number you want to print ";
cin>>a;
int row = 1;
char k = 'A';
while(row<=a){
int col =1;
while(col<= a){
cout<<k<<" ";
col++;
k = k+1;
}
cout<<endl;
row++;
}
}
14)
enter the number4
A B C D E
B C D E F
C D E F G
D E F G H
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int a;
cout<<"enter the number";
cin>>a;
int row = 1;
while(row<=a){
int col = 0;
while(col<=a){
char ch = 'A'+row+col-1;
cout<<ch<<" ";
col++;
}
cout<<endl;
row++;
}
}
15)
enter the number4
A
B B
C C C
D D D D
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int a;
cout<<"enter the number";
cin>>a;
int row = 1;
while(row<=a){
int col = 1;
while(col<=row){
char ch = 'A'+row-1;
cout<<ch<<" ";
col++;
}
cout<<endl;
row++;
}
}
16)
enter the number4
A
B C
C D E
D E F G
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int a;
cout<<"enter the number";
cin>>a;
int row = 1;
while(row<=a){
int col = 0;
while(col<row){
char ch = 'A'+row+col-1;
cout<<ch<<" ";
col++;
}
cout<<endl;
row++;
}
}
17)
enter the number4
A
B C
D E F
G H I J
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int a;
cout<<"enter the number";
cin>>a;
int row = 1;
char val = 'A';
while(row<=a){
int col = 1;
while(col<=row){
cout<<val<<" ";
col++;
val = val + 1;
}
cout<<endl;
row++;
}
}
18)
enter the number4
A
B C
C D E
D E F G
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int a;
cout<<"enter the number";
cin>>a;
int row = 1;
while(row<=a){
int col = 1;
while(col<=row){
char start = 'A' + row+col-2;
cout<<start<<" ";
col++;
}
cout<<endl;
row++;
}
}
19)
enter the number4
D
C D
B C D
A B C D
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int a;
cout<<"enter the number";
cin>>a;
int row = 1;
while(row<=a){
int col = 1;
char start = 'A' + a-row;
while(col<=row){
cout<<start<<" ";
start++;
col++;
}
cout<<endl;
row++;
}
}
20 )
enter the number3
A B C
B C D
C D E
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int a;
cout<<"enter the number";
cin>>a;
int row = 1;
while(row<=a){
int col = 1;
char start = 'A' + row-col;
while(col<=a){
cout<<start<<" ";
col++;
start = start+1;
}
cout<<endl;
row++;
}
}
21)
enter the number3
__*
_**
***
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int a;
cout<<"enter the number";
cin>>a;
int row = 1;
while(row<=a){
// space ko print karte hai
int space = a-row;
while(space){
cout<<"_";
space--;
}
// * astrick print karlo
int col = 1;
while(col <= row){
cout<<"*";
col++;
}
cout<<endl;
row++;
}
}
22)
enter the number4
****
***
**
*
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int a;
cout<<"enter the number";
cin>>a;
int row = 1;
while(row<=a){
int col = 1;
// * astrick print karlo
int k = a-row+col;
while(col <= k){
cout<<"*";
col++;
}
cout<<endl;
row++;
}
}
23)
enter the number4
___1234
__12341
_123421
1234321
#include<iostream>
using namespace std;
int main(){
cout<<"enter the number";
int a;
cin>>a;
int i =1;
while(i<=a){
int space = a-i;
while(space){
cout<<"_";
space = space -1;
}
int j = 1;
while(j<=a){
cout<<j;
j++;
}
int start = i - 1;
while(start){
cout<<start;
start = start - 1;
}
cout<<endl;
i++;
}
}
24)
enter the number4
****
_***
__**
___*
code:-
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int a;
cout<<"enter the number";
cin>>a;
int row = 1;
while(row<=a){
int space = 1;
while(space<row){
cout<<"_";
space++;
}
int col = 1;
// * astrick print karlo
int k = a-row+col;
while(col <= k){
cout<<"*";
col++;
}
cout<<endl;
row++;
}
}
25)
enter the number5
55555
_4444
__333
___22
____1
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int a;
cout<<"enter the number";
cin>>a;
int row = 1;
while(row<=a){
int space = 1;
while(space<row){
cout<<"_";
space++;
}
int col = 1;
// * astrick print karlo
int k = a-row+col;
while(col <= k){
cout<<k;
col++;
}
cout<<endl;
row++;
}
}
26)
Enter the value5
1111
222
33
4
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int row;
cout<<"Enter the value";
cin>>row;
int i = 1;
int j = 1;
while(i<=row){
while(j<i){
cout<<"_";
j++;
}
int col = 1;
int count = row - i;
while(col<=count){
cout<<i;
col++;
}
cout<<"\n";
i++;
}
return 0;
}
27)
Enter the number Which you have to want print5
1234
234
34
4
#include <iostream>
using namespace std;
int main(){
int row;
cout<<"Enter the number Which you have to want print";
cin>>row;
int i = 1;
int startColumn = 1;
while(i<=row){
int k = 1;
while(k<i){
cout<<" ";
k++;
}
int j = startColumn;
int col = row-1;
while(j<=col){
cout<<j;
j++;
}
cout<<"\n";
i++;
startColumn++;
}
}
28)
Enter the number Which you have to want print5
1
22
333
4444
#include <iostream>
using namespace std;
int main(){
int row;
cout<<"Enter the number Which you have to want print";
cin>>row;
int i = 1;
int startColumn = 1;
while(i<row){
int k = row - startColumn;
int space = 1;
while(space <= k){
cout<<" ";
space++;
}
int col = 1;
while(col<=startColumn){
cout<<startColumn;
col++;
}
cout<<"\n";
startColumn++;
i++;
}
}
27)
Enter the number Which you have to want print5
1
23
456
78910
#include <iostream>
using namespace std;
int main(){
int row;
cout<<"Enter the number Which you have to want print";
cin>>row;
int i = 1;
int startColumn = 1;
while(i<row){
int k = row - startColumn;
int space = 1;
while(space <= k){
cout<<" ";
space++;
}
int col = 1;
int newColumn = 1;
while(col<=i){
cout<<startColumn;
col++;
startColumn++;
}
cout<<"\n";
i++;
}
}
29)
#include <iostream>
using namespace std;
int main()
{
int row;
cout<<"Enter the number here";
cin>>row;
int i = 1;
int k = row;
while(i<=row){
int startRow = row-i;
int col = 1;
while(col<=startRow){
cout<<col;
col++;
}
// print * in this section
int star = 1;
while(star < startRow){
cout<<"*";
star++;
}
int j = 1;
while(j<=row){
cout<<j;
j++;
}
cout<<"\n";
i++;
}
return 0;
}
30 )
Enter the number Which you have to want print5
1
21
321
4321
#include <iostream>
using namespace std;
int main(){
int row;
cout<<"Enter the number Which you have to want print";
cin>>row;
int i = 1;
int startColumn = 1;
while(i<=row){
int col = 1;
int digit = i - 1;
while(col<i){
cout<<digit;
col++;
digit--;
}
cout<<"\n";
i++;
}
}
Thanks you for commenting your questions. I will see question and respond you.