For c program Write a code to display the following pattern
For c++ program
Write a code to display the following pattern using nested for loops.
*******
******
*****
****
***
**
*
Solution
Solution.cpp
#include <iostream>//header file for inputoutput function
 using namespace std;//it tells the compiler to link std namespace
 int main()
 {//main function
     int m,n,num;
     cout<<\"Enter the number of rows: \";
     cin>>num;//key board inputting
     for(m=num;m>=1;--m)
     {//nested forloop
         for(n=1;n<=m;++n)
         {
            cout<<\"* \";
         }
         cout<<\"\ \";
     }
     return 0;
 }
output
Enter the number of rows: 7
 * * * * * * *
 * * * * * *
 * * * * *
 * * * *
 * * *
 * *
 *

