|
안녕하세요? 레조입니다.
함수를 사용하실때 인수를 넣는 부분에서 잘못되었었네요.
#include <stdio.h>
float div(int a, int b); /*prototype of division fuction*/
float mod(int a, int b); /*prototype of surplus fuction*/
void main(void)
{
int a, b;
float div_value, modulus;
a = 10;
b = 5;
div_value = div( a, b );
modulus = mod( a, b );
printf("%d 을 %d 로 나눈 값은 %f 이고 나머지는 %f 이다", a, b, div_value, modulus);
}
float div(int a, int b) /*calculate division*/
{
return(a/b);
}
float mod(int a, int b) /*calculate modulus*/
{
return(a%b);
}
씨_java 님이 쓰신 글 :
: /*fuction을 이용한 나눈값과 나머지 구하기*/
:
: #include <stdio.h>
:
: float div(int a, int b); /*prototype of division fuction*/
: float mod(int a, int b); /*prototype of surplus fuction*/
:
: void main(void)
: {
: int a, b;
: float div_value, modulus;
: a = 10;
: b = 5;
:
: div_value = div(int a, int b);
: modulus = mod(int a, int b);
: printf("%d 을 %d 로 나눈 값은 %f 이고 나머지는 %f 이다", a, b, div_value, modulus);
: }
:
: float div(int a, int b) /*calculate division*/
: {
: return(a/b);
: }
: float mod(int a, int b) /*calculate modulus*/
: {
: return(a%b);
: }
:
: 어디가 틀렸는지 모르겠습니다...부탁드리겠습니다.....
|