3
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 3 years have passed since last update.

み垣もり衛士のたく火の夜はもえ昼は消えつつものをこそ思へ

Advent Calendar 2022 101日目1の記事です。
I'm looking forward to 12/25,2022 :santa::santa_tone1::santa_tone2::santa_tone3::santa_tone4::santa_tone5:
私のAdvent Calendar 2022 一覧


はじめに

この記事は、AtCoderB - FizzBuzz Sum問題をC#で解いてみます。

私はC#初心者です。
なにかのタイミングで「C#やってみます!」と元気よく書いた気がするので、おもむろにAtCoderをC#で解いてみます。
B - FizzBuzz Sum問題は良い問題だとおもっています。

AtCoderとは?

AtCoderは、世界最高峰の競技プログラミングサイトです。
リアルタイムのオンラインコンテストで競い合うことや、
3,000以上の過去問にいつでもチャレンジすることができます。

プログラム

using System;
 
class Program
{
    static void Main()
    {
        long n = long.Parse(Console.ReadLine());
        long sum = 0;
        for (long i = 1; i <= n; i++)
        {
            if (i % 3 == 0 || i % 5 == 0) {
                continue;
            } else {
                sum += i;
            }
         }
         Console.WriteLine($"{sum}");
    }
}

C#(.NET Core 3.1.201) でパスしました。


Wrapping up :lgtm::lgtm::lgtm::lgtm::lgtm:

この記事は、AtCoderB - FizzBuzz Sum問題をC#で解いてみました

以上です。


Enjoy Elixir:bangbang::bangbang::bangbang:
$\huge{Enjoy\ Elixir🚀}$

I organize autoracex.
And I take part in NervesJP, fukuoka.ex, EDI, tokyo.ex, Pelemay.
I hope someday you'll join us.

We Are The Alchemists, my friends!


  1. @kaizen_nagoya さんの「「@e99h2121 アドベントカレンダーではありますまいか Advent Calendar 2020」の改訂版ではありますまいか Advent Calendar 2022 1日目 Most Breakthrough Generator」から着想を得て、模倣いたしました。

3
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
3
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?