c与运算来使奇数为1偶数为0

#include"stdio.h"
void main()
{ int i,j; i = 6;
while(i--)
{
printf("please input/n");
scanf("%d",&j); j = (j&1);
printf("output%d/n",j);
}
system("pause");
}
注意(j&1)的技巧 按位与运算 0x01
posted @ 2011-05-12 20:04  foreverlearn  阅读(183)  评论(0编辑  收藏  举报