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

【C言語】繰り返し処理(while,for)

Last updated at Posted at 2024-11-05

用途 : 処理を繰り返す

while文

  • 式が偽(0)になるまで処理を繰り返したい場合
while()
{
    処理
}
  • 式によらず、必ず1度処理したい場合
do
{
    処理
}
while()

for文

・while文とは違い、実行回数を数えて処理を行う場合

// 処理を10回繰り返す
for(int i = 0; i < 10; i++)
{
    処理
}

continue・break

for文の中にcontinue・breakを記述すると、以下の処理が行われる
continue : 次の繰り返し処理(イテレーション)へ
break : 繰り返しの中断

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