This is not homework but it is supposed to be the third warm up before I actually begin the homework. I asked my lab instructor but he said to declare the function but i do not know what he is talking about. It stops when it hits the
Code:
return ( even( n - 1 )); /* n is odd if and only n-1 is even
I have deleted it, but when i do that the comp says everything is odd
Code:
#include <stdio.h>
int odd(int n)
{
if ( n == 1 ) /* if n is 1 then it is certainly true that it is odd */
return ( 1 );
else
return ( even( n - 1 )); /* n is odd if and only n-1 is even */
}
int even(int n)
{
if ( n == 0 ) /* if n is 0 then it is certainly true that it is even */
return ( 1 );
else
return ( odd( n - 1) ); /* n is even if and only n-1 is odd */
}
main()
{
int N;
printf("Please input a n integer.\n");
scanf("%d", &N);
if ( odd(N) )
printf("The number %d is odd.\n", N);
else
printf("The number %d is even.\n", N);
}