63 126
Assignments Done
99%
Successfully Done
In July 2018

Answer to Question #14016 in C++ for shalenee

Question #14016
(Finding numbers divisible by 5 or 6 but not both) Write a program that displays, ten numbers pr line, all the numbers from 100 to 200 that are divisible by 5 or 6 but not both.
Expert's answer
#include <iostream>
using namespace std;

int main(){
int k = 0;
for (int i = 100 ; i < 200 ; i++){
& if (((i%5 == 0) || (i%6 == 0)) && !((i%5 == 0) && (i%6 == 0))) {
& k++;
&
& cout<<i<<' ';

& if (k == 10) {
& k = 0;
& cout<<endl;
& }
& }
}


system("pause");
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