Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
[Problem Description]
Output [1, N] satisfying the condition of the range of numbers, these numbers are multiples of 7, or 7 comprising a number of, for example, (27, 37 ... 71, 72 ...)
[Enter] form a positive integer N. (N is not greater than 30,000)
[Output] in ascending order form is no greater than about 7 and a positive integer, each row of a N. If such numbers do not exist within the range, any information is not output.
[Sample input]
20
[Sample output]
7
14
17
[DESCRIPTION sample within 20, 7, and 14 is a multiple of 7, 17 7 comprises a digital
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
if(i%7==0||i%10==7||i/10%10==7||i/100%10==7||i/1000%10==7)
cout<<i<<endl;
}
return 0;
}