C言語 最大値を求める。
[crayon]
/*
 ============================================================================
 Name        : ensyuu3-6.c
 Author      :
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */
#include 
int main (void)
{
		int num1, num2, num3, num4, max;
		puts(“四つの整数を入力して下さい。\n”);
		printf(“整数1:”); fflush(0); scanf(“%d”, &num1);
		printf(“整数2:”); fflush(0); scanf(“%d”, &num2);
		printf(“整数3:”); fflush(0); scanf(“%d”, &num3);
		printf(“整数4:”); fflush(0); scanf(“%d”, &num4);
		max = num1;
		if(num2 > max) max = num2;
		if(num3 > max) max = num3;
		if(num4 > max) max = num4;
		printf(“最大値は%dです。”, max);
		return(0);
}
[/crayon]
参照:http://nekohand.web.fc2.com/meikai/neko_meikai_c_ans.html
