I am new to C++. i want to write a program that finds factors of a no. and puts them in array and prints it. i have written a program but it is wrong. PLease correct it.Thank you.
#include<iostream>
using namespace std;
int main()
{
int b,c,i;
int myarray= [10];
cout<<"Please enter nos"<<endl;
cin>>b;
for(c=2;c<b;c++)
{
if (b%c==0)
{
for(i=0;i<10,i++)
{
myarray[i]=c;
}
}
}
cout<<"The factors of the no. are"<<myarray[i]<<endl;
return 0;
}