PRINTING OUT PRIME NUMBERS USING PASS BY REFERENCE in c++
#include<iostream>
using namespace std;
void primearray(int arr[],int size);
int main(){
int arr[20]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
primearray(arr,20);
}
void primearray(int arr[],int size){
int count=5;
for(int x=0;x<size;x++){
int count=5;
for(int y=2;y<(arr[x]);y++){
if(arr[x]%y==0){
count=-2;
}
}
if(count>0){
cout<<x<<" = "<<arr[x]<<endl;
}
}
}
EmoticonEmoticon