Answer to Question #20736 in C++ for ahmed

Question #20736
write to program to store 100 random numbers in array and store all the numbers which are multiples of 7 in another arry.print both
1
Expert's answer
2012-12-20T07:38:56-0500
#include <iostream>
#include <conio.h>
#include <time.h>
using namespace std;


//main function
int main()
{
srand (time (NULL));
int arraofnumbers[100];
int arraofnumbersmod7[100];
for(int i=0;i<100;i++){
arraofnumbers[i]=rand()1;
}
int count=0;
for(int i=0;i<100;i++){
if(arraofnumbers[i]%7==0){
arraofnumbersmod7[count]=arraofnumbers[i];
count++;
}

}
for(int i=0;i<100;i++){
cout<<arraofnumbers[i]<<" ";
}
cout<<"
";
for(int i=0;i<count;i++){
cout<<arraofnumbersmod7[i]<<" ";
}
getch();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS