WAP C++ to right side star pattern

    *
   **
  ***
 ****
*****

Code:-

#include <iostream>

using namespace std;

int main()
{
    int r = 5;
  
    //The first loop creates the rows
    for (int i = 0; i < r; i++) {
  
        // loop for print whitespaces
        for (int j = 0; j <  (r - i) ; j++) {
            cout<<" ";
        }
  
        // loop for print The * character
        for (int k = 0; k <= i; k++) {
            cout<<"*";
        }
       cout<<endl;
    }
    return 0;
}