WAP to print the following output using for loops (C++)

1
22
333
4444
55555
…………
#include <iostream.h>
int main()
{int n;
cout<<"Enter the no. of lines : ";
cin>>n;
for (int i=1; i<=n; i++)
    {for (int j=1; j<=i; j++)
        {cout<<i;
        }
    cout<<"\n";
    }
return 0;
}
problem 3.3 from E Balagurusamy’s Object Oriented Programming C++ (p 75)

Comments

  1. please show output for 24 20 16 using for loops please...
    12 8
    4

    ReplyDelete
  2. Kindly use stackoverflow.com for any programming help.

    I am busy these days, and also have not coded in C++ in years (doing Web development in PHP these days).

    ReplyDelete
  3. Write a program to print following output using for loop.
    1
    23
    456
    78910
    Plz send code to me c#

    ReplyDelete
    Replies
    1. Kindly use stackoverflow.com for any programming help.

      Delete

Post a Comment

Kindly keep your comments on-topic and don't spam.