Your problem is that
n
is not a parameter but a local variable
void even_odd(int n){
must be replaced by
void even_odd()
int n;{
Ooops, you also need to change the line before
main
to
void even_odd();
If you compile as is, Turbo C will tell you that there is another problem because
i
and
n
are used in
even_odd
but declared in
main
.
the source code with both corrections will look like
# include <stdio.h>
# include <conio.h>
void even_odd();
int main()
{
clrscr() ;
even_odd();
getch() ;
return 0;
}
void even_odd(){
int n, i ;
printf("Enter Integer : ") ;
scanf("%d", &n) ;
printf("\nThe odd numbers are :\n\n") ;
for(i = 1 ; i <= n ; i = i + 2)
printf("%d\t", i) ;
printf("\n\nThe even numbers are :\n\n") ;
for(i = 2 ; i <= n ; i = i + 2)
printf("%d\t", i) ;
}
</conio.h></stdio.h>