fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void tekaTekiTeko(unsigned int batas) {
  5. for(unsigned int num = 1; num <= batas; num++){
  6. string res = "";
  7.  
  8. if(num % 2 == 0) {
  9. res += "Teka";
  10. } if(num % 3 == 0) {
  11. res += "Teki";
  12. } if(num % 5 == 0) {
  13. res += "Teko";
  14. }
  15.  
  16. if(res.empty()) {
  17. cout << num << endl;
  18. } else {
  19. cout << res << endl;
  20. }
  21. }
  22. }
  23.  
  24. int main() {
  25. tekaTekiTeko(30);
  26. return 0;
  27. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
1
Teka
Teki
Teka
Teko
TekaTeki
7
Teka
Teki
TekaTeko
11
TekaTeki
13
Teka
TekiTeko
Teka
17
TekaTeki
19
TekaTeko
Teki
Teka
23
TekaTeki
Teko
Teka
Teki
Teka
29
TekaTekiTeko