Thank You For Coming My Blog. This Blog is Everyone so You Read and Share another...

Monday, May 13, 2019

Nested Loop Program in C++ (Object Oriented Programming Language)



1-                                                                                solve- #include<iostream.h>
*   *   *   *   *                                        # include<conio.h>
*   *    *   *   *                                          void main()
*   *   *   *   *                                          {
*   *   *   *   *                                                int a,b;
*   *   *   *   *                                                clrscr();
                                                              for(a=1;a<=5;a++)
                                                               {
                                                              for(b=1;b<=5;b++)
                                                              cout<<”*’’;
                                                              cout<<”\n”;
                                                                     }
                                                              getch();
                                                              }
2-                                                                              
solve- #include<iostream.h>
1   2   3   4   5                                         # include<conio.h>
1   2   3   4   5                                         void main()
1   2   3   4   5                                          {
1   2   3   4   5                                         int a,b;
1   2   3   4   5                                         clrscr();
                                                       for(a=1;a<=5;a++)
                                                               {
                                                       for(b=1;b<=5;b++)
                                                       cout<<b;
                                                       cout<<”\n”;
                                                              }
                                                       getch();
                                                              }
3-
solve- #include<iostream.h>
1   1   1   1   1                                          # include<conio.h>
2   2   2   2   2                                            void main()
3   3   3   3   3                                          {
4   4   4   4   4                                         int a,b;
5   5   5   5   5                                         clrscr();
                                                       for(a=1;a<=5;a++)
                                                               {
                                                       for(b=1;b<=5;b++)
                                                       cout<<a;
                                                       cout<<”\n”;
                                                              }
                                                       getch();
                                                              }



4-
solve- #include<iostream.h>
*                                                            # include<conio.h>
*   *                                                 void main()
*   *   *                                             {
*   *   *   *                                       int a,b;
*   *   *   *   *                                         clrscr();
                                                       for(a=1;a<=5;a++)
                                                               {
                                                       for(b=1;b<=a;b++)
                                                       cout<<”*”;
                                                       cout<<”\n”;
                                                              }
                                                       getch();
                                                              }
5-
solve- #include<iostream.h>
1                                                             # include<conio.h>
1   2                                                  void main()
1   2   3                                             {
1   2   3   4                                       int a,b;
1   2   3   4   5                                         clrscr();
                                                       for(a=1;a<=5;a++)
                                                               {
                                                       for(b=1;b<=a;b++)
                                                       cout<<b;
                                                       cout<<”\n”;
                                                              }
                                                       getch();
                                                              }
6-
solve- #include<iostream.h>
1                                                             # include<conio.h>
2   2                                                 void main()
3   3   3                                             {
4   4   4   4                                       int a,b;
5   5   5   5   5                                         clrscr();
                                                       for(a=1;a<=5;a++)
                                                               {
                                                       for(b=1;b<=a;b++)
                                                       cout<<a;
                                                       cout<<”\n”;
                                                              }
                                                       getch();
                                                              }


7-
solve- #include<iostream.h>
*   *   *   *   *                                   # include<conio.h>
*   *   *   *                                        void main()
*   *   *                                                       {
*   *                                                        int a,b;
*                                                            clrscr();
                                                       for(a=5;a>=1;a--)
                                                               {
                                                       for(b=1;b<=a;b++)
                                                       cout<<”*”;
                                                       cout<<”\n”;
                                                              }
                                                       getch();
                                                              }
8-
solve- #include<iostream.h>
5   5   5   5   5                                  # include<conio.h>
4   4   4   4                                        void main()
3   3   3                                                       {
2   2                                                        int a,b;
1                                                            clrscr();
                                                       for(a=5;a>=1;a--)
                                                               {
                                                       for(b=1;b<=a;b++)
                                                       cout<<a;
                                                       cout<<”\n”;
                                                              }
                                                       getch();
                                                              }
9-
solve- #include<iostream.h>
1   2   3   4   5                                  # include<conio.h>
1   2   3   4                                        void main()
1   2   3                                                       {
1   2                                                        int a,b;
1                                                            clrscr();
                                                       for(a=5;a>=1;a--)
                                                               {
                                                       for(b=1;b<=a;b++)
                                                       cout<<b;
                                                       cout<<”\n”;
                                                              }
                                                       getch();
                                                              }


10-
solve- #include<iostream.h>
*                                                             # include<conio.h>
*   *                                                  void main()
*   *   *                                             {
*   *   *   *                                       int a,b;
*   *   *   *   *                                         clrscr();
*   *   *   *                                       for(a=1;a<=5;a++)
*   *   *                                                    {
*   *                                                for(b=1;b<=a;b++)
*                                                     cout<<”*”;
                                                       cout<<”\n”;
                                                              }
                                                       for(a=4;a.=1;a--)
                                                              {
                                                       for(b=1;b<=a;b++)
cout<<”*”;
cout<<”\n”;
}
                                                       getch();
                                                              }

No comments:

Post a Comment