#include <iostream> #include <sstream> #include <string> using namespace std; int nabeatu(int num) { for (int i=1; i <= num; i++) { if (i % 3 == 0) { cout << i << "〜〜〜" << endl; continue; }else if(i % 8 == 0) { cout << i << "ぅぅういえぇえあ" << endl; continue; } stringstream ss; ss << i; string hoge = ss.str(); bool flag = false; for (int j=0; j < hoge.size(); j++) { if (hoge[j] == '3') { cout << i << "〜〜〜" << endl; flag = true; break; } } if (flag) { continue; } cout << i << endl; } return 0; } //何となく1行で int fizzbuzz(int n) {for (int i=1; i <= n; i++) {if (i%3==0&&i%5==0) {cout << "FizzBuzz" << endl; continue;} if (i%3==0) {cout << "Fizz" << endl; continue;} if (i%5==0) {cout << "Bizz" << endl; continue;} cout << i << endl;} return 0;} int main() { nabeatu(400); fizzbuzz(400); return 0; }