Fine Even without Mod
To find a number which is even or odd without using mod function we divide the number by 2 and the multiply by 2 again
/*
http://www.ProbCOMP.com
To find a number which is even or odd without using mod function
we divide the number by 2 so if it is even we dont get any decimal part
so on multiplying by 2 we get the same number but with odd number since decimal
part gets eliminated we dont get the original number
*/
#include<stdio.h>
void main()
{
int n;
printf("enter the number= ");
scanf("%d",&n);
if(n/2*2==n)
printf("even");
else
printf("odd");
}
Download Program


