#include <iostream>

using namespace std;

const int N=3;

class Vector

{

    int V[N];

    public:

    Vector()

    {

        for(int i=0;i<N;i++)

        V[i]=0;

    }

    Vector(int *y)

    {

        for(int i=0;i<N;i++)

        V[i]=y[i];

    }

   friend Vector operator*(int a, Vector b );

    friend Vector operator*(Vector b , int a );

    friend istream & operator >>(istream &, Vector & );

    friend ostream & operator <<(ostream &, Vector & );

};

 Vector operator*(int a, Vector b )

    {

        Vector C;

        for(int i=0;i<N;i++)

        C.V[i]=a*b.V[i];

        

        return C;

    }

     Vector operator*(Vector b , int a )

    {

        Vector C;

        for(int i=0;i<N;i++)

        C.V[i]=b.V[i]*a;

        

        return C;

    }

  istream & operator>>(istream &input, Vector &b )

 {

     for(int i=0;i<N;i++)

        input>> b.V[i];

     return (input);

 }

  ostream & operator<<(ostream &output, Vector &b )

 {

     output << " ( " << b.V[0];

     for(int i=1;i<N;i++)

        output << "," << b.V[i];

        

     output<< ")";

     return (output);

 }

 int Z[N]={3,6,9};

int main() {

// Your code goes here;

Vector M;

Vector K=Z;

cout<<" Enter elements of vector M" << "\n";

cin>>M;

cout<<"\n";

cout<<" M=" << M <<"\n";


Vector P,Q;

P= 3*M;

Q= K * 4;


cout<<"\n";

cout<<" P=" << P <<"\n";

cout<<" Q=" << Q <<"\n";

return 0;

}

output:

Enter elements of vector M

5 10 15

M= ( 5,10,15)


 P= ( 15,30,45)

 Q= ( 12,24,36)