함수파트에서 리턴값 받는 문제에 관한 질문입니다.
지나
2023.04.01
함수 네임은 totamt()이고4개의 정수 arguments의 네임은 quarters, dimes, nickels, pennies입니다. 또한 이들을 달러로 환산된 값으로 리턴받는건데요 제가 짜기를 아래와 같이 짰는데 여기서 출력할 때 위의 4개에 입력값을 넣었을때 출력도 저 4개의 값이 달러값으로 환산되서 출력하게 하고자 하는데 저의 코드경우 quarters값 하나만 환산되서 출력됩니다;; 저 4개를 다 나오게 하려면 어케해야되나요 ㅠㅠ?
#include stdio.h
void main()
{
float totamt(int, int, int, int);
float tot;
int quarters, dimes, nickels, pennies;
printf(quarters: );
scanf(%d, &quarters);
printf(dimes: );
scanf(%d, &dimes);
printf(nickels: );
scanf(%d, &nickels);
printf(pennies: );
scanf(%d, &pennies);
tot = totamt(quarters, dimes, nickels, pennies);
printf(%f dollar\n, tot);
}
float totamt(int Q, int D, int N, int P)
{
return(.25 * Q, .1 * D, .05 * N, .01 * P);
}