12/31/2022 0 Comments Java program to add two octal numbers![]() ![]() Divide the number by 2 using operator and store the remainder somewhere. These values will be stored in binary1 and binary2 named variables respectively. We can write our own logic for decimal to binary conversion in java. Then, the user is asked to enter the values of two binary numbers. Asking for Input printf("Enter first binary number: ") scanf("%ld", &binary1) printf("Enter second binary number: ") scanf("%ld", &binary2) We have also initialized the variables i and rem to 0. In this program, we have declared two long data type variables named binary1 and binary2. ![]() Output Enter first binary number: 10101Enter second binary number: 11100Sum of two binary numbers is: 110001 How Does This Program Work ? long int binary1, binary2 int i = 0, rem = 0, sum C Program To Add Two Binary Numbers // C Program To Add Two Binary Numbers#include int main() ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
February 2023
Categories |