C
Chad
Given the following...
#include <stdio.h>
int div(int a, int b)
{
return (a % b == 0);
}
int main(void)
{
printf("the value is: %d\n",div(4,2));
return 0;
}
I get a value of 1 when I run the program...
[cdalten@localhost oakland]$ gcc -g -Wall div.c -o div
[cdalten@localhost oakland]$ ./div
the value is: 1
[cdalten@localhost oakland]$
If 4%2 == 0, then should return look something like
return (0 == 0);
and since 0 == 0, shouldn't return statement return a value of 0
instead of 1 in this case?
#include <stdio.h>
int div(int a, int b)
{
return (a % b == 0);
}
int main(void)
{
printf("the value is: %d\n",div(4,2));
return 0;
}
I get a value of 1 when I run the program...
[cdalten@localhost oakland]$ gcc -g -Wall div.c -o div
[cdalten@localhost oakland]$ ./div
the value is: 1
[cdalten@localhost oakland]$
If 4%2 == 0, then should return look something like
return (0 == 0);
and since 0 == 0, shouldn't return statement return a value of 0
instead of 1 in this case?