This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Hoge | |
| def fuga(var) | |
| if var%15 == 0 then | |
| return 15 | |
| elsif var%5 == 0 then | |
| return 5 | |
| elsif var%3 == 0 then | |
| return 3 | |
| else | |
| return var |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| puts "値を入力してください" | |
| val = gets.to_i | |
| for num in 1..val do | |
| if num%15 == 0 then | |
| puts "FizzBuzz" | |
| elsif num%5 == 0 then | |
| puts "Buzz" | |
| elsif num%3 == 0 then | |
| puts "Fizz" | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <string.h> | |
| //換算率 | |
| const int rate = 120; | |
| int main() { | |
| char str[50]; | |
| printf("データを入力してください:"); | |
| // 入力読みこみ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string> | |
| int main() { | |
| std::cout << "N = "; | |
| int var; | |
| std::cin >> var; | |
| for (int i = 1; i <= var; i++) | |
| std::cout << i << (i % 3 == 0 || std::to_string(i).find("3") != std::string::npos ? "アホ" : "") << std::endl; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let var=input('N=') | |
| echo "\n" | |
| for i in range(1, var) | |
| let flag=((i%3==0)||(matchstr(i,3)!='')) | |
| if flag | |
| echo i . 'アホ' | |
| else | |
| echo i | |
| endif | |
| endfor |
NewerOlder