Wap to print the following pattern :
1
1 3
1 3 5
1 3 5 7
1 3 5 7 9
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j;
for(i=0;i<=10;i+=2)
{
cout<<"\n";
for(j=1;j<=i;j+=2)
{
cout<<j;
}
getch();
}
*****************************
OUTPUT:
1
1 3
1 3 5
1 3 5 7
1 3 5 7 9
*****************************
C++ Program to Print number pattern
ReplyDeleteIn c++ we can easily print any number patter just we need two for loop one inner loop for increment and decrements and other for line break.