0
How can I create a c++ program to print the numbers between 1-50 which are divisible by 5&7?
2 odpowiedzi
+ 11
#include<iostream>
using namespace std;
int main(){
for(int I=1;I <= 50; I++){
if(I % 5 == 0 || I % 7 ==0)
cout << I << endl;
}
}
+ 3
To be a little facetious:
#include<iostream>
using namespace std;
int main(){cout << 35 << endl;}
Technically, this is the correct answer to the question you asked. If you were looking for a program to print all numbers between 1 and 50, which are divisible by 5 or divisible by 7, then go with Mr.Robot's answer.