Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   hi all, I dont have any clue how to accomplish this. Pls provide ne clues ...Thanks.. (http://www.go4expert.com/forums/hi-i-dont-clue-accomplish-pls-provide-t21126/)

prietysharma121 27Feb2010 01:22

hi all, I dont have any clue how to accomplish this. Pls provide ne clues ...Thanks..
hello everybody,

I need some help regarding my project.....any hints clues will be highly appreciated.....Thanks its very urgent .....
This project will require you to develop three C functions:

float nandFloatMul(float a, float b) float nandFloatAdd(float a, float b) float nandFloatSub(float a, float b)

Each of the above functions takes as input two float operands and returns their product, sum, and difference, respectively, as a float.

You must also implement the following “helper” functions:
int boolNand(int i, int j)
int bitWiseNand(int i, int j)

Notes: 1. boolNand() returns zero if and only if both inputs are not zero. 2. bitWiseNand() returns the bit-wise nand of the inputs. 3. You may implement versions of boolNand() and bitWiseNand() in any,

or all, integral C data types. Requirements:
1. In implementing your nandFloat*() functions, you may only use: (a) boolNand(), (b) bitWiseNand(), (c) the C assignment (=) operator, and (d) the C shifting operators (<< and >>).

virxen 28Feb2010 05:34

Re: hi all, I dont have any clue how to accomplish this. Pls provide ne clues ...Than
this is the skeleton of your program.You must edit
nandFoat* functions to supply your instructions.
the other 2 helper functions are ok.


#include <stdio.h>

float nandFloatMul(float, float);
float nandFloatAdd(float, float);
float nandFloatSub(float, float);
int boolNand(int , int );
int bitWiseNand(int, int);

float nandFloatMul(float a, float b){
    return a*b;

float nandFloatAdd(float a, float b){
    return a+b;

float nandFloatSub(float a, float b){
    return a-b;

int boolNand(int i, int j){
    if (i!=0 && j!=0) return 0;
    return 1;

int bitWiseNand(int i, int j){
 return  !(i&j);

int main(){
    float a=5.3,b=6.3;
    int a1=1,b1=1;
    printf("\nbitwise NAND(%d,%d)=%d",a1,b1,bitWiseNand(a1,b1));
    return 0;   

happy coding

All times are GMT +5.5. The time now is 08:45.