Showing posts with label FUN WITH C. Show all posts
Showing posts with label FUN WITH C. Show all posts

Sunday, August 28, 2011

Finding a number is even or odd without using arithmatic operators

#include < stdio.h >
main()
{
     int i,j;   /*int type variables*/
     scanf("%d",&i);/*read i value*/
     j=i&1;    /*perform logical AND operation */
     if(j==0)
          printf("even");
     else
          printf("odd");

}

Math is Fun Games

Saturday, August 20, 2011

I AM AN IDIOT.

#include "stdio.h"
#include "conio.h"
void main()
{char ch[]="I AM AN IDIOT.";
char c='A';
int i=0;
while(c)
{
c=getch();
printf("%c\a",ch[i]);
i++;

if(i==14)
{printf(" "); i=0;

}
}
}