• 検索結果がありません。

陞溷、郢晢スォ郢晢スシ郢br/>

N/A
N/A
Protected

Academic year: 2021

シェア "陞溷、郢晢スォ郢晢スシ郢br/>"

Copied!
3
0
0

読み込み中.... (全文を見る)

全文

(1)

1

多重ループ 

82

1.1

学習のポイント

ループの中にまたループが入っている多重ループについて学びます。  今までは1重ループについてだけ説明しましたが、ループの中にまたループが入る多重 ループを作ることもできます。ループの中にループが入ることをネスト(入れ子)と呼び ます。 特にfor文は次のように多重ループにすることがよくあります。 for(i = 1; i <= 9; i++){ for(j = 1; j <= 9; j++){ printf("%4d", i * j); } } 多重ループでは最も内側のループから先にくり返されていきます。上のプログラムは九九 の表を作るものですが、まず、i = 1 で内側のループに入り、jを1から9までくり返し、 つのつど i*j の値をディスプレイの横方向に表示していきます。jのくり返しが終わると、 printf("\n")を実行し、再び同じことを 1から9 になるまでくり返します。 C言語 河西朝雄著 ナツメ社 62頁 1

(2)

1.2

例題

11 reidai11.c 63

*で三角形をつくりなさい。 /* *で三角形をつくりなさい。 reidai11.c */ #include <stdio.h> int main() { int j; int k; for(j = 1; j <= 10; j++){ for(k = 1; k <= j; k++){ printf("*"); } printf("\n"); } return 0; } 2

(3)

1.3

練習問題

11 rensyu11.c 63

次のような三角形を表示するプログラムを作りなさい。 ********** ********* ******** ******* ****** ***** **** *** ** * /* 次のような三角形を表示するプログラムを作りなさい。 rensyu11.c */ #include <stdio.h> int main() { int j; int k; for(j = 10; j >= 1; j--){ for(k = 1; k <= j; k++){ printf("*"); } printf("\n"); } return 0; } 3

参照

関連したドキュメント

There is a bijection between left cosets of S n in the affine group and certain types of partitions (see Bjorner and Brenti (1996) and Eriksson and Eriksson (1998)).. In B-B,

We establish sharp Br´ezis-Gallou¨et-Wainger type inequalities in Besov and Triebel-Lizorkin spaces as well as fractional Sobolev spaces on a bounded domain Ω ⊂ R n.. We treat

(The Elliott-Halberstam conjecture does allow one to take B = 2 in (1.39), and therefore leads to small improve- ments in Huxley’s results, which for r ≥ 2 are weaker than the result

[r]

“Breuil-M´ezard conjecture and modularity lifting for potentially semistable deformations after

lines. Notice that Theorem 4 can be reformulated so as to give the mean harmonic stability of the configuration rather than that of the separate foliations. To this end it is

S., Oxford Advanced Learner's Dictionary of Current English, Oxford University Press, Oxford

At the end of the section, we will be in the position to present the main result of this work: a representation of the inverse of T under certain conditions on the H¨older