Special Programs in C − Adding Two Numbers Without Using The Plus Operator (Half Adder Method)

preview_player
Показать описание
C Programming & Data Structures: Special C Programs − Adding Two Numbers Without Using The Plus Operator (Half Adder Method),
Topics discussed:
1) Half Adder
2) Sum and Carry in Half Adder
3) C program for adding two numbers using half adder logic

Music:
Axol x Alex Skrindo - You [NCS Release]

#CProgrammingByNeso #CProgramming #HalfAdderProgram
Рекомендации по теме
Комментарии
Автор

Very neat clean vivid explanation with step by step solution programming made easy!

ajmalkhaniit
Автор

Sir I understood all the previous topics in this Playlist but only this topic is difficult to understand. Please explain sum and carry variables and which value is exactly stored in them.

omgaikwad
Автор

why you are not using a-(-b), this is the very simple logic

karthickrock
Автор

I think there's an error. If you enter b = 0, it'll print garbage value as the output. You didn't consider that possibility?

filmoviNaTi
Автор

Mast Sir, Vedios so helpful for us, we all proud of you sir😘😘😘

mayuringale
Автор

Why everyone here is happy? I didn't understand anything from this lesson. It's extremely hard!

Wesm
Автор

Thank u brother for making me understand in a simple way

shubhamjain
Автор

The left shift and right shift operators should not be used for negative numbersIf any of the operands is a negative number, it results in undefined .
Sir can you please clear this point when you entered the negative numbers how it is giving the correct answer.

umairalvi
Автор

Your lectures are very helpful for my classes. Thank you very much!!!

altyncharyyeva
Автор

Sir make one video please minus numbers. how to write binary.
This program you write only positive binary number. Thank you sir

venkythesmart
Автор

a-(-b) krlo guru bina + ke kara doonga. Thanks garry shashank for this wonderful explaination

shauryaharma
Автор

After the loop, assign sum = a; before printf just incase b = 0;

lawrencemuthui
Автор

Thank you so such detailed explanation

ShivaniSingh-jtkl
Автор

4:20
I guess those equations wont give proper ans everytime
Bec,
When you do 5+10 in binary, the ans is 15 in which sum is 15 while carry is 0
But,
When you do 7+2 in binary, the ans is 9, but the sum you get using Xor is 5 while the Carry you get using Bitwise And is 2, and lets say even if you add that 5 with 2 also, still you get the Sum using Xor as 7 and Carry using Bitwise And as 0, and now you aren't left with any further carries found using Bitwise And in order to add it up with the Sum we found using Xor i.e. 7!!!

mislead
Автор

/*This is my version of the program */
//Adding two integers without the + sign :
#include <stdio.h>
int main()
{
printf("Give a and b\n");
int a, b, i;
scanf("%d %d", &a, &b);
if (b>=0) {
for (i=0; i<b; i++)
{
a++;
}
}
else {
for (i=0; i<-b; i++)
{
a--;
}
}

printf("The sum of a and b is :%d\n", a);
return 0;
}

Strategic.
Автор

Sir we can write one while loop for addition of two no. In that while we can we if .else

vrishabshetty
Автор

int main()
{ int n, a;
printf("Enter two number\n");
scanf("%d%d", &n, &a);
int sum=n;
for(int i=1;i<=abs(a);i++)
{ if(a>=0)
sum++;
else
sum--;
}

printf("The sum of %d and %d is : %d", n, a, sum);

return 0;
}
This does the same.

Abhishek-yfwi
Автор

Sir please explain logic for multiplication operations with using *operator

mounikapavani
Автор

given numbers in decimal format, then why we do not convert these numbers in binary format

yogeshlather
Автор

You should have explained the logic of the program by using -ve values too.

vasubhatt