「arithmetic_operatorプロジェクト」の編集履歴(バックアップ)一覧はこちら
追加された行は緑色になります。
削除された行は赤色になります。
***arithmetic_operator.c
#highlight(c){{
/*------------------------------------------------------------------------------
* Title: arithmetic_operator
* Project: arithmetic_operator
* Source: arithmetic_operator.c
* Author: B.G
* Group: B.G
* Created: 12:46 2009/11/07
* Last Modified: 12:46 2009/11/07
* ---------------------------------------------------------------------------*/
/* ヘッダファイルのインクルード */
#include <stdio.h> /* stdio.hのインクルード */
/* main関数 */
int main(void){
/* 変数の宣言 */
int result_add; /* 加算の結果を格納するint型変数result_add */
int result_sub; /* 減算の結果を格納するint型変数result_sub */
int result_mul; /* 乗算の結果を格納するint型変数result_mul */
int result_div; /* 除算の結果を格納するint型変数result_div */
int result_mod; /* 剰余算の結果を格納するint型変数result_mod */
/* 加算 */
result_add = 1 + 2; /* 加算演算子'+'で1に2を足す */
printf("1 + 2 = %d\n", result_add); /* 結果をprintfで出力 */
/* 減算 */
result_sub = 3 - 2; /* 減算演算子'-'で3から2を引く */
printf("3 - 2 = %d\n", result_sub); /* 結果をprintfで出力 */
/* 乗算 */
result_mul = 3 * 4; /* 乗算演算子'*'で3に4を掛ける */
printf("3 * 4 = %d\n", result_mul); /* 結果をprintfで出力 */
/* 除算 */
result_div = 12 / 4; /* 除算演算子'/'で12を4で割る */
printf("12 / 4 = %d\n", result_div); /* 結果をprintfで出力 */
/* 剰余算 */
result_mod = 5 % 2; /* 剰余算演算子'%'で5を2で割った余りを求める */
printf("5 %% 2 = %d\n", result_mod); /* 結果をprintfで出力 */
/* プログラムの終了 */
return 0;
}
}}