main

Similar documents
C言語7

P05.ppt

P06.ppt

PowerPoint Presentation

C言語によるアルゴリズムとデータ構造

新版明解C言語入門編

Microsoft Word - no15.docx

P02.ppt

gengo1-11

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

Microsoft Word - no14.docx

tuat1.dvi

P03.ppt

untitled

() / (front end) (back end) (phase) (pass) 1 2

解きながら学ぶC言語




新・明解C言語で学ぶアルゴリズムとデータ構造

DVIOUT

PSCHG000.PS

A/B (2010/10/08) Ver kurino/2010/soft/soft.html A/B

新・明解C言語 ポインタ完全攻略


無印良品のスキンケア

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

(search: ) [1] ( ) 2 (linear search) (sequential search) 1

2

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y

Microsoft Word - no206.docx

初歩のC言語ターミナル_2014_May.pages

超初心者用

I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2 " 2 B R b

Taro-リストⅢ(公開版).jtd

( ) ( ) lex LL(1) LL(1)

Microsoft Word - no12.doc

[1] #include<stdio.h> main() { printf("hello, world."); return 0; } (G1) int long int float ± ±

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* (

C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç

関数の動作 / printhw(); 7 printf(" n"); printhw(); printf("############ n"); 4 printhw(); 5 関数の作り方 ( 関数名 ) 戻り値 ( 後述 ) void である. 関数名 (

17 1. strucr Potter ( ) Harry Potter and the Philosopher s Stone 1997 English Title : Harry Potter and the Philosopher s Stone : : 1997 #include<stdio

Microsoft Word - no11.docx


サポートブック

DVIOUT

untitled

kiso2-06.key

Microsoft Word - no15.docx

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

untitled

新版明解C言語 実践編

8 if switch for while do while 2

Microsoft Word - no205.docx

printf("5つの整数を入力して下さい \n"); /* データ入力 */ for( /*** 02 ***/ ){ printf("%dつ目の入力 :",i+1); scanf("%d", /*** 03 ***/ ); sum=dat[0]; /* 合計値の初期設定 */ n_max= 0

1.ppt


Microsoft Word - no13.docx

18 C ( ) hello world.c 1 #include <stdio.h> 2 3 main() 4 { 5 printf("hello World\n"); 6 } [ ] [ ] #include <stdio.h> % cc hello_world.c %./a.o

ex01.dvi

Microsoft PowerPoint - 説明3_if文switch文(C_guide3)【2015新教材対応確認済み】.pptx

橡Pro PDF

: : : : ) ) 1. d ij f i e i x i v j m a ij m f ij n x i =

Taro-最大値探索法の開発(公開版

Microsoft PowerPoint - C言語の復習(配布用).ppt [互換モード]

kiso2-09.key

201908計算

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

<4D F736F F D20438CBE8CEA8D758DC F0939A82C282AB2E646F63>

1 4 2 EP) (EP) (EP)

:30 12:00 I. I VI II. III. IV. a d V. VI

Java 3 p.2 3 Java : boolean Graphics draw3drect fill3drect C int C OK while (1) int boolean switch case C Calendar java.util.calendar A

& & a a * * ptr p int a ; int *a ; int a ; int a int *a

I117 II I117 PROGRAMMING PRACTICE II SOFTWARE DEVELOPMENT ENV. 1 Research Center for Advanced Computing Infrastructure (RCACI) / Yasuhiro Ohara

Taro-再帰関数Ⅰ(公開版).jtd

:30 12:00 I. I VI II. III. IV. a d V. VI

r07.dvi

Microsoft Word - C言語研修 C++編 3.doc

ohp07.dvi

プログラミング基礎

明解Javaによるアルゴリズムとデータ構造

Microsoft Word - C.....u.K...doc

r1.dvi

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >=

c-all.dvi

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² –

Microsoft Word - Cプログラミング演習(10)

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡

ex01.dvi

Microsoft PowerPoint - prog13.ppt

Taro-2分探索木Ⅱ(公開版).jtd

XMPによる並列化実装2

新・明解Javaで学ぶアルゴリズムとデータ構造

WinHPC ppt

プログラミング入門1

comment.dvi

K227 Java 2

() () (parse tree) ( (( ) * 50) ) ( ( NUM 10 + NUM 30 ) * NUM 50 ) ( * ) ( + ) NUM 50 NUM NUM (abstract syntax tree, AST) ( (( ) * 5

LIFO(last in first out, ) 1 FIFO(first in first out, ) 2 2 PUSH POP : 1

Microsoft PowerPoint - program.ppt [互換モード]

Transcription:

14 1. 12 5 main 1.23 3 1.230000 3 1.860867 1

2. 1988 1925 1911 1867 void JPcalendar(int x) 1987 1 64 1 1 1 while(1) Ctrl C void JPcalendar(int x){ if (x > 1988) printf(" %d %d \n", x, x-1988); else if(x > 1925) /* */ else printf(" \n"); int num; while(1){ printf(" "); scanf("%d", &num); JPcalendar(num); return 0; 2013 2013 25 1980 1980 55 1900 1900 33 1925 1925 14 1912 1912 1 1860 ^C 2

3. 2 1989 1989 1 64 1926 1912 void JPcalendar(int x){ if (x > 1989) printf(" %d %d \n", x, x-1988); else if(x == 1989) printf(" %d 1 %d \n", x, x-1925); /* */ else printf(" \n"); /* 2 */ 1912 1912 1 45 1926 1926 1 15 1989 1989 1 64 2010 2010 22 ^C 3

4. 13 5 int gcd(int n, int r) void reducefrac(int a, int b) int gcd(int n, int r){ /* */ return tmp; void reducefrac(int a, int b){ int na, nb; /* */ if(nb!= 1) printf("%d/%d %d/%d \n", a, b, na, nb); else printf("%d/%d %d \n", a, b, na); int n1, n2, m; printf(" \n"); while(1){ printf(" :"); scanf("%d", &n1); printf(" :"); scanf("%d", &n2); reducefrac(n1, n2); return 0; 4

:20 :30 20/30 2/3 :21 :49 21/49 3/7 :25 :75 25/75 1/3 :72 :12 72/12 6 :^C 5

5. (Fibonacci) 1, 1, 2, 3, 5, 8, 13, 21, 34, 1 2 1 2 1 + 1 = 2, 1 + 2 = 3, 2 + 3 = 5, 3 + 5 = 8, m void fibonacci(int m)? void fibonacci(int m){ int i, n3; int n1=0; int n2=1; printf("%d\n", n2); for(i=1; i<m; i++){ n3 =?; printf("%d\n", n3); n1 =?; n2 =?; int num; printf(" "); scanf("%d", &num); fibonacci(num); return 0; 6

20 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 7

6. 4 na nb main int na, nb; // int gcd(int n, int r){ /* */ void reducefrac(int a, int b){ /* */ int n1, n2; printf(" \n"); while(1){ printf(" :"); scanf("%d", &n1); printf(" :"); scanf("%d", &n2); reducefrac(n1, n2); // if(nb!= 1) printf("%d/%d %d/%d \n", n1, n2, na, nb); else printf("%d/%d %d \n", n1, n2, na); return 0; 8

:6 :15 6/15 2/5 :63 :7 63/7 9 :13 :91 13/91 1/7 :39 :91 39/91 3/7 :^C 9

7. s t + u v = sv + tu tv void addfrac(int s, int t, int u, int v) 2 n1/n2 n3/n4 p=sv+tu q=tv int p, q; // void addfrac(int s, int t, int u, int v){ /* */ int n1, n2, n3, n4; while(1){ printf(" 1 \n"); printf(" :"); scanf("%d", &n1); printf(" :"); scanf("%d", &n2); printf(" 2 \n"); printf(" :"); scanf("%d", &n3); printf(" :"); scanf("%d", &n4); addfrac(n1, n2, n3, n4); printf("%d/%d+%d/%d=%d/%d\n", n1, n2, n3, n4, p, q); return 0; 10

1 :1 :2 2 :2 :3 1/2+2/3=7/6 1 :3 :5 2 :7 :11 3/5+7/11=68/55 1 :1 :6 2 :2 :6 1/6+2/6=18/36 1 :^C 11

8. 7 int gcd(int n, int r) void reducefrac(int a, int b) p/q int na, nb; // int gcd(int n, int r){ /* */ void reducefrac(int a, int b){ /* */ void addfrac(int s, int t, int u, int v){ /* */ int n1, n2, n3, n4; while(1){ printf(" 1 \n"); printf(" :"); scanf("%d", &n1); printf(" :"); scanf("%d", &n2); printf(" 2 \n"); printf(" :"); scanf("%d", &n3); printf(" :"); scanf("%d", &n4); addfrac(n1, n2, n3, n4); if(nb!=1) printf("%d/%d+%d/%d=%d/%d\n", n1, n2, n3, n4, na, nb); else printf("%d/%d+%d/%d=%d\n", n1, n2, n3, n4, na); return 0; 12

1 :1 :8 2 :3 :8 1/8+3/8=1/2 1 :3 :7 2 :4 :7 3/7+4/7=1 1 :1 :6 2 :1 :2 1/6+1/2=2/3 1 :22 :123 2 :9 :11 22/123+9/11=1349/1353 1 :^C 13