本日の課題
2010.5.17
Obtained numbers are 1.838 and 1.698. Product of them is 3.121 (3.121e+00). Quotient of them is 1.082 (1.082e+00). |
/* ************************************************** */ /* */ /* 情報科学演習 C6 C7 */ /* レポート課題 */ /* 2010.5.17 */ /* */ /* ************************************************** */ /* */ /* 学生番号: */ /* */ /* 氏名: */ /* */ /* ************************************************** */ /* */ /* この行以降に解答のプログラムを書くこと */ #include <stdio.h> #include <stdlib.h> #include <time.h> main() { srand((unsigned) time(NULL)); float chelsea, liverpool, arsenal, tottenham; chelsea = rand() % 999 / 1000.0 + 1.001; liverpool = rand() % 999 / 1000.0 + 1.001; arsenal = chelsea * liverpool; tottenham = chelsea / liverpool; printf("Obtained numbers are %1.3f and %1.3f.\n", chelsea, liverpool); printf("Product of them is %1.3f (%1.3e).\n", arsenal, arsenal); printf("Quotient of them is %1.3f (%1.3e).\n", tottenham, tottenham); return(0); } |