Skip to content
-
Number System In C
Method 1 – Using loops #include <stdio.h> int main() { int OCTALVALUES[] = {0, 1, 10, 11, 100, 101, 110, 111}; long long octal, tempOctal, binary, place; int rem; printf("Enter any Octal number: "); scanf("%lld", &octal); tempOctal = octal; binary = 0; place = 1; while(tempOctal > 0) […]
-
Number System In C
Method 1 #include <stdio.h> int main() { int octalConstant[] = {0, 1, 10, 11, 100, 101, 110, 111}; long long binary, octal, tempBinary; int digit, place, i; octal = 0; place= 1; /* Input binary number from user */ printf("Enter any binary number: "); scanf("%lld", &binary); /* Copy original binary value to temp variable */ […]
-
Number System In C
Method 1 #include <stdio.h> #include <string.h> int main() { int hexConstant[] = {0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111}; long long binary, tempBinary; char hex[20]; int index, i, digit; /* Input binary number from user */ printf("Enter binary number: "); scanf("%lld", &binary); /* Copy binary number […]