問題及代碼
/*
* Copyright (c) 2016, CSDN
* All rights reserved
* 文件名稱: 項目3--分支結構程序設計體驗(2).c
* 作 者: 韓兆駿
* 完成日期: 2016年10月31日
* 版 本 號: v1.0
*
* 問題描述:輸入3個整數,輸出其中的最大值。
*/
#include <stdio.h>
int main()
{
int a, b, c, max;
printf("Please input three integer value : \n");
scanf("%d %d %d", &a, &b, &c);
if(a <= b)
{
max = b;
if( b <= c)
{
max = c;
}
}
else
{
max = a;
if(a <= c)
{
max = c;
}
}
printf("The maximum value is : %d\n", max);
return 0;
}
運行結果