Back To C++ Loops Index
program to print pattern
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
//program to input a number n and print pattern of numbers from 1 to n (example of nested loop) #include
#include
void main() { int n; int i,j; clrscr(); cout<<"\nenter a value for n "; cin>>n; for(i=1;i<=n;i++) { for(j=1;j<=i;j++) { cout<