64 736
Assignments Done
99,3%
Successfully Done
In September 2018

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
Expert's answer
#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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions