[C언어] 실습: 함수를 이용하여 정수 두 개의 합과 곱을 계산하여 출력하는 프로그램 구현하기
함수를 이용하여 정수 두 개의 합과 곱을 계산하여 출력하는 프로그램 구현하기 #include void computer(int, int, int*, int*); int main(){ int x, y; int sum = 0, mul = 0; printf("두 개의 정수 입력[x, y] : "); // 두 개의 정수를 입력받는다. scanf("%d, %d", &x, &y); computer(x, y, &sum, &mul); // 합과 곱을 구하는 함수를 호출한다. printf("%d + %d = %d\n", x, y, sum); printf("%d x %d = %d\n", x, y, mul); return 0; } void computer(int num1, int num2, int *tot, int *mult..
[C언어] 실습: 함수를 호출하여 입력받은 숫자 세 개를 큰 순서대로 나열하기
함수를 호출하여 입력받은 숫자 세 개를 큰 순서대로 나열하기 #include void exchange(double*, double*); void sort_ck(double*, double*, double*); int main(){ double first, second, third; printf("첫 번째 수: "); scanf("%lf", &first); printf("두 번째 수: "); scanf("%lf", &second); printf("세 번째 수: "); scanf("%lf", &third); sort_ck(&first, &second, &third); printf("수 나열 : %lf >= %lf >= %lf\n", first, second, third); } void sort_ck(doub..