Wap in cpp to print following pattern using for loop 1 11 111 1111 11111

Wap in cpp to print following pattern using for loop
1
11
111
1111
11111

#include<iostream.h>
#include<conio.h>
void main()
{ int i,j;
for(i=1;i<=5;i++)
{

for(j=1;j<=i; j++)
{ cout<<”1”; }
}
getch();
}

5 comments:

  1. Anonymous8/28/2014

    gud and helpful

    ReplyDelete
  2. why would we use j loop in this case

    ReplyDelete
    Replies
    1. its not j loop its for loop
      j is just variable

      Delete
  3. j is variable
    for loop is used because it allow control to be in our hand

    ReplyDelete

If You Like The Post Or want to Add Something More
then feel free to comment