Finding a number is even or odd without using arithmetic operators
logical operators plays a bit2bit operations.&operators chechs whether the bit is present at perticular position or not. if 1 is at lsb(right most in binary) then that no is odd.
1. #include<stdio.h>
2. main()
3. {
4. int i,j; /*int type variables*/
5. scanf("%d",i);/*read i value*/
6. j=i&1; /*perform logical and operation to find 1at lsb
7. if(j==0)
8. printf("even");
9. else
10. printf("odd");
11. getch();
12. }