0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

多言語FizzBuzzAdvent Calendar 2022

Day 5

多言語FizzBuzzチャレンジ5日目:C言語

Last updated at Posted at 2022-12-04

ここまでのまとめ

本日のお品書き

泣く子も黙るC言語。
触ったことはありますが、心を折られた苦い記憶がありますね…。

FizzBuzz

#include <stdio.h>

int main(void) {
  /*セミコロンを完璧に忘れていた*/
  int i;
  for (i = 1; i < 101; i++) {
    if (i % 15 == 0) {
      printf("FizzBuzz\n");
    } else if (i % 3 == 0) {
      printf("Fizz\n");
    } else if (i % 5 == 0) {
      printf("Buzz\n");
    } else {
      printf("%d\n", i);
    }
  }
  return 0;
}

LSPでいい感じにフォーマットしてくれるようになって時代を感じました(感想が古い)

【おまけ】コンパイルまで

# edit main.c
gcc main.c
./a.out
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?