C/알고리즘
네 값의 최댓값
네 정수를 입력받고 그 중 최댓값을 출력해라 # include int max4(int a,int b,int c,int d) { int max = a; if(max < b) max = b; if(max < c) max = c; if(max < d) max = d; return max; } int main() { int a,b,c,d; printf("4개의 정수를 입력하세요 : "); scanf("%d %d %d %d",&a,&b,&c,&d); printf("max4(%d %d %d %d) = %d\n",a,b,c,d,max4(a,b,c,d)); return 0; }
2020. 9. 17. 10:19
최근댓글