Friday, 27 June 2014

C program for OR gate implementation

Program :
#include<stdio.h>
void main()
 {
   unsigned int x:1;  
   unsigned int y:1;                                   /* because of this x and y will only take either 1 or 0 value*/
   printf("Enter 1st binary number");
   scanf("%u",&x);
    printf("Enter 2nd binary number");
   scanf("%u",&y);
   x<=y ?  printf("Answer of OR operation is %u",y) : printf("Answer of OR operation is %u",x);
 }

No comments:

Post a Comment