C Program to find even or odd using no parameter, with return type

#include”stdio.h”
#include”conio.h”
int evenodd();
void main()
{
int result;
clrscr();
result=evenodd();
if(result==0)
printf(“Number is Even”);
if(result==1)
printf(“Number is Odd”);
getch();
}

int evenodd()
{
int n;
printf(“Enter number : “);
scanf(“%d”,n);
if(n%2==0)
return 0;
else
return 1;
}

Advertisements

Program for addition of two input using Functions

#include<stdio.h.>
#include<conio.h>
int main();
void main()
{
int result;
result=addition();
printf(“%d”,result);
getch();
}

int addition()
{
int n1, n2, sum;
printf(“Enter two number : “);
scanf(“%d%d”,&n1,&n2);
sum=n1+n2;
return (sum);
}