2節の問題  


1 出力結果
(a)  私の名前は坂本竜馬です
(b)  私の名前は
     坂本竜馬です
(c)  私の年齢は19です
(d)
     私の年齢は
     19です
(e)  私の年齢は19で、
     身長は170CMです。
(f)  2
(g)  3-2
     2-3
(h)  1+2*3=1+2*3
(i)  100%日本製です


2 訂正
(a)  エラーがあります");             "が必要
(b)  "この命令にはエラーがあります"  ' 文 'ではなく" 文 "
(c)  printf                            fが欠けてる
(d)  ("10")                            "  "が必要
(e) ("整数=%d\n",5)                  5を出力させるのに%dが必要
(f)  ("整数=%d%d",i,j)                j=3を出力させるのに%dがもう一つ必要
(g)  "整数=%d",j                       j=3を出力させるのに%dが必要


3 出力命令

(a)  #include
     main(){int a,b; a=2;b=4;
            printf("最初の数a=%2d\n次の数b=%4d",a,b);}
(b)  #include
     main(){int a,b,c; a=5;b=6;c=7;
            printf("最初の数a=%2d\n次の数b=%3d\n次の数=%4d",a,b,c);}
(c)  #include
     main(){int ii,j; i=3; j=4;
            printf("%d+%d=%d",i,j,i+j);}
(d)  #include
     main(){double pai=3.14;
            printf("πの値は%fです。",pai);}




課題を表示する場へ
TOPへ