implement NAND gate logic in C code without using any
bitwise operatior.

Answers were Sorted based on User's Feedback



implement NAND gate logic in C code without using any bitwise operatior...

Answer / laxmi bose

#include<stdio.h>
main()
{
int a,b;
scanf("%d%d",&a,&b);
if(a==0||b==0)
{
printf("1");
}
else
{
printf("0");
}

Is This Answer Correct ?    42 Yes 13 No

implement NAND gate logic in C code without using any bitwise operatior...

Answer / senthil.cp

NAND using Bitwise operators
c = ~(a & b) OR
c = ~a | ~b

NAND without using bitwise operators

c = (0xFF - a) + (0xFF - b)

Is This Answer Correct ?    35 Yes 16 No

implement NAND gate logic in C code without using any bitwise operatior...

Answer / vadivel t

int a, b;
scanf("%d %d", &a, &b);
if(a != 0 || b != 0)
{
printf("1");
}
else
{
printf("0");
}

Is This Answer Correct ?    28 Yes 20 No

implement NAND gate logic in C code without using any bitwise operatior...

Answer / qwake

!(a*b)

Is This Answer Correct ?    6 Yes 4 No

Post New Answer

More C Interview Questions

how many times of error occur in C

11 Answers  


What is the use of bitwise operator?

0 Answers  


I came across some code that puts a (void) cast before each call to printf. Why?

0 Answers  


Why is it important to memset a variable, immediately after allocating memory to it ?

0 Answers  


declare afunction pointer to int printf(char *)?

1 Answers   HCL,






how to go with this?

1 Answers   Wipro,


find the size of structure without using the size of function

1 Answers   Bosch,


Program to write some contents into a file using file operations with proper error messages.

2 Answers  


main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); }

11 Answers   CISOC, CitiGroup, College School Exams Tests,


What is the difference between functions abs() and fabs()?

0 Answers  


What is clrscr in c?

0 Answers  


what is difference between overriding and overloading?

1 Answers  


Categories