Answer the question
In order to leave comments, you need to log in
Find all numbers that are not multiples of 5 and multiples of 3 and whose sum of digits are also non-multiples of 5 and multiples of 3. C++ problem?
Good day! Can you help with the task in C++? I can't find the sum of these numbers.
#include <iostream>
using namespace std;
int main()
{
setlocale(LC_ALL,"Russian");
int i=1,n,sum ;
cout <<"Введите n(максимальное число) -> ";
cin >> n;
while(i<=n){
if(i%3==0 && i%5)
{
cout<<"Числа,которые кратны 3 и не кратны 5 -> "<<i<<endl;
}
i++;
}
return 0;
}
Answer the question
In order to leave comments, you need to log in
In order to find the sum of the digits of a number, you need to divide this number into digits and then calculate their sum. https://stackoverflow.com/questions/3389264/how-to...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question