#include <iostream>
    using namespace std;

int main() {
     int x;
    int n;
    cout<<"enter 1st number  "<<endl;
    cin>>n;           //number of elements
        int i;
        cout<<"enter 2nd number  "<<endl;
    cin>>x;          // value of r in gp
    int a;
            cout<<" enter 3rd number  "<<endl;
            cin>>a;         // initial number
            

    for (i=1 ; i<=n ; i++){         //loop statement 
        cout<<x<<"  ";        //printing condition
        x=x*a;               // GP formula

    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: