Browse Source

Update BasicMode.c

remotes/origin/develop
fdai7801 11 months ago
parent
commit
1452d3f6c7
  1. 12
      src/main/c/BasicMode.c

12
src/main/c/BasicMode.c

@ -33,7 +33,7 @@ long long int BinToDec(long long int n) {
return dec; return dec;
} }
//addition //addition
long long int addition(long long int a, long long int b) {
long long int additionbin(long long int a, long long int b) {
long long int dec1, dec2; long long int dec1, dec2;
dec1 = BinToDec(a); dec1 = BinToDec(a);
dec2 = BinToDec(b); dec2 = BinToDec(b);
@ -43,7 +43,7 @@ long long int addition(long long int a, long long int b) {
return dec2; return dec2;
} }
// multiplication // multiplication
long long int multiplication(long long int a, long long int b) {
long long int multiplicationbin(long long int a, long long int b) {
long long int dec1, dec2; long long int dec1, dec2;
dec1 = BinToDec(a); dec1 = BinToDec(a);
dec2 = BinToDec(b); dec2 = BinToDec(b);
@ -53,7 +53,7 @@ long long int multiplication(long long int a, long long int b) {
return dec2; return dec2;
} }
//subtraction //subtraction
long long int subtraction(long long int a, long long int b) {
long long int subtractionbin(long long int a, long long int b) {
long long int dec1, dec2; long long int dec1, dec2;
dec1 = BinToDec(a); dec1 = BinToDec(a);
dec2 = BinToDec(b); dec2 = BinToDec(b);
@ -99,7 +99,7 @@ int main() {
scanf("%lld", &bin1); scanf("%lld", &bin1);
printf("enter the second binary number: "); printf("enter the second binary number: ");
scanf("%lld", &bin2); scanf("%lld", &bin2);
result = addition(bin1, bin2);
result = additionbin(bin1, bin2);
printf("%lld+%d = %lld\n", bin1, bin2, result); printf("%lld+%d = %lld\n", bin1, bin2, result);
break; break;
@ -108,7 +108,7 @@ int main() {
scanf("%lld", &bin1); scanf("%lld", &bin1);
printf("enter the second binary number: "); printf("enter the second binary number: ");
scanf("%lld", &bin2); scanf("%lld", &bin2);
result = subtraction(bin1, bin2);
result = subtractionbin(bin1, bin2);
printf("%lld-%lld = %lld\n", bin1, bin2, result); printf("%lld-%lld = %lld\n", bin1, bin2, result);
break; break;
@ -117,7 +117,7 @@ int main() {
scanf("%lld", &bin1); scanf("%lld", &bin1);
printf("enter the second binary number: "); printf("enter the second binary number: ");
scanf("%lld", &bin2); scanf("%lld", &bin2);
result = multiplication(bin1, bin2);
result = multiplicationbin(bin1, bin2);
printf("%lld*%d = %lld\n", bin1, bin2, result); printf("%lld*%d = %lld\n", bin1, bin2, result);
break; break;

Loading…
Cancel
Save