Input a number and print whether it is even or odd.
#include <stdio.h>
#include <conio.h>
void evnodd ( int ); /* Prototype declaration */
void main ( )
{
int n;
clrscr ( );
printf("\n\n\n\t\t Enter a number..:"); scanf("%d",&n);
evnodd(n); /* function calling */
getch ( );
}
void evnodd ( int p ) /* Function definition */
{
if ( p % 2 == 0 )
{
printf("\n\n\t\t The number is even.");
}
else
{
printf("\n\n\t\t The number is odd.");
}
}
Click here to contact us
#include <stdio.h>
#include <conio.h>
void evnodd ( int ); /* Prototype declaration */
void main ( )
{
int n;
clrscr ( );
printf("\n\n\n\t\t Enter a number..:"); scanf("%d",&n);
evnodd(n); /* function calling */
getch ( );
}
void evnodd ( int p ) /* Function definition */
{
if ( p % 2 == 0 )
{
printf("\n\n\t\t The number is even.");
}
else
{
printf("\n\n\t\t The number is odd.");
}
}
Click here to contact us
No comments:
Post a Comment