TheAlgorithms-C-Plus-Plus/Others/Buzz_number.cpp

18 lines
357 B
C++
Raw Normal View History

2017-12-24 01:30:49 +08:00
//A buzz number is a number that is either divisble by 7 or has last digit as 7.
#include <iostream>
using namespace std;
int main()
{
2019-08-21 10:10:08 +08:00
int n, t;
2017-12-24 01:30:49 +08:00
cin >> t;
2019-08-21 10:10:08 +08:00
while (t--)
2017-12-24 01:30:49 +08:00
{
2019-08-21 10:10:08 +08:00
cin >> n;
if ((n % 7 == 0) || (n % 10 == 7))
cout << n << " is a buzz number" << endl;
else
cout << n << " is not a buzz number" << endl;
2017-12-24 01:30:49 +08:00
}
return 0;
}