TheAlgorithms-C-Plus-Plus/others/buzz_number.cpp

23 lines
453 B
C++
Raw Normal View History

2020-05-28 06:00:02 +08:00
/**
* @file
* @brief A buzz number is a number that is either divisible by 7 or has last
* digit as 7.
*/
2017-12-24 01:30:49 +08:00
#include <iostream>
2020-05-28 06:00:02 +08:00
/** main function */
int main()
{
2020-05-28 06:00:02 +08:00
int n, t;
std::cin >> t;
while (t--)
{
2020-05-28 06:00:02 +08:00
std::cin >> n;
if ((n % 7 == 0) || (n % 10 == 7))
std::cout << n << " is a buzz number" << std::endl;
else
std::cout << n << " is not a buzz number" << std::endl;
}
return 0;
2017-12-24 01:30:49 +08:00
}