Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a C function for carry and sum seperately. usingAND (&&),OR(||), and NOT(!

ID: 3616449 • Letter: W

Question

write a C function for carry and sum seperately. usingAND (&&),OR(||), and NOT(!) gates for following truthtable. only I need only two seperate functionsone for Carry and one for Sum. not the wholeprogram. X    Y   Z      SUM      CARRY 0     0   0         0               0 0     0    1         1               0 0     1   0         1               0 0     1    1         0               1 1     0    0         1               0 1     0    1         0               1 1     1    0         0                1 1     1    1       1               1 write a C function for carry and sum seperately. usingAND (&&),OR(||), and NOT(!) gates for following truthtable. only I need only two seperate functionsone for Carry and one for Sum. not the wholeprogram. X    Y   Z      SUM      CARRY 0     0   0         0               0 0     0    1         1               0 0     1   0         1               0 0     1    1         0               1 1     0    0         1               0 1     0    1         0               1 1     1    0         0                1 1     1    1       1               1

Explanation / Answer

int sum(int x, int y, int z) {    if( (((x && y) &&z) ==0)&& (((x || y) ||z) == 0))        return 0;    else if( (((x && y) &&z) ==0)&& (((x || y) ||z) == 1) && ( ((x && y)==1) || ((x && z) ==1) || ((y && z) ==1) ))        return 0;    else if ( (((x && y) &&z) ==0)&& (((x || y) ||z) == 1) && ( (x ==1) || (y ==1) ||(z ==1) ))        return 1;    else        return 1; } int carry(int x, int y, int z) {    if( (((x && y) &&z) ==0)&& (((x || y) ||z) == 0))        return 0;    else if( (((x && y) &&z) ==0)&& (((x || y) ||z) == 1) && ( ((x && y)==1) || ((x && z) ==1) || ((y && z) ==1) ))        return 1;    else if ( (((x && y) &&z) ==0)&& (((x || y) ||z) == 1) && ( (x ==1) || (y ==1) ||(z ==1) ))        return 0;    else        return 1; }