Presentation is loading. Please wait.

Presentation is loading. Please wait.

#include <stdio. h> int main() { /. 表示をする

Similar presentations


Presentation on theme: "#include <stdio. h> int main() { /. 表示をする"— Presentation transcript:

1 #include <stdio. h> int main() { /. 表示をする
#include <stdio.h> int main() { /* 表示をする */ printf("Yes My Master\n"); printf("May I help you\n"); return(0); } Yes My Master May I help you

2 #include <stdio. h> int main() { /. printfのさまざまな使い方
#include <stdio.h> int main() { /* printfのさまざまな使い方 */ printf("10/3=%d\n",10/3); printf("10/3=%f\n",10.0/3.0); printf("10/3=%lf\n",10.0/3.0); printf("7+1=%3d\n",7+1); printf("7*9=%3d\n",7*9); printf("7+1=%.3f\n", ); return(0); } 10/3=3 10/3= 7+1= 8 7*9= 63 7/3=2.333

3 #include <stdio. h> int main() { /. 10000円での釣銭表示
#include <stdio.h> int main() { /* 10000円での釣銭表示 */ printf("10000: %d\n", (12*9+15*7)*1.05); /* 5000円での釣銭表示 */ printf("5000 : %d\n", 5000-(12*9+15*7)*1.05); /* 1000円での釣銭表示 */ printf("1000 : %d\n", 1000-(12*9+15*7)*1.05); return(0); } 10000: 5000 : 1000 :

4 #include <stdio. h> int main() { /. 変数を用意
#include <stdio.h> int main() { /* 変数を用意 */ int total; total = (12*9+15*7)*1.05; /* 10000円での釣銭表示 */ printf("10000: %d\n", total); /* 5000円での釣銭表示 */ printf("5000 : %d\n", 5000-total); /* 1000円での釣銭表示 */ printf("1000 : %d\n", 1000-total); return(0); } 10000: 9777 5000 : 4777 1000 : 777

5 #include <stdio. h> int main() { /. 様々な変数の型
#include <stdio.h> int main() { /* 様々な変数の型 */ int num; long int l_num; float f_num; double d_num; num = -1-2; /* 整数値 */ l_num = ; /* より大きな値の整数値を入れられる */ f_num = 1.234; /* 実数値 */ d_num = ; /* より精度の高い実数値を入れられる */ printf("%d\n", num); /* int型の表示には%dを指定 */ printf("%ld\n", l_num); /* int型の表示には%dを指定 */ printf("%f\n", f_num); /* int型の表示には%dを指定 */ printf("%lf\n", d_num); /* int型の表示には%dを指定 */ return(0); } -3


Download ppt "#include <stdio. h> int main() { /. 表示をする"

Similar presentations


Ads by Google