1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#include <iostream>
using namespace std;
int function(int*, int);
int main ()
{
int* a;
int* b;
int n;
cout << "How much natural numbers will you enter? >>> ";
cin >> n;
cout <<endl;
a=new int[n];
for(int i=0;i<n; i++)
{
cout<< "Number " << i+1 << " >>> ";
cin>>a[i];
}
for(int j=0;j<n;j++)
{
cout<<function(a,n)<<endl;
}
delete [] a;
return 0;
}
int function(int* a, int n)
{
for(int j=0;j<n;j++)
for (int i=2;i<a[j];i++)
if (a[j]%i==0) cout << a[j];
}
|
Last edited on
Need to input results from array a in line 39 in array b ( line 26).
Would be really grateful if someone would help.
BUMP:
1 2 3 4 5 6 7 8
|
int function(int* a, int n)
{
for(int j=0;j<n;j++)
for (int i=2;i<a[j];i++)
if (a[j]%i==0) cout << a[j];
}
|
If my array is 6 2 9
it prints 6690
Last edited on