This commit is contained in:
2025-02-03 08:38:52 +03:00
parent 7522af1dc2
commit bb35fb2db6
7 changed files with 41 additions and 0 deletions

24
test/test1.c Normal file
View File

@ -0,0 +1,24 @@
#include <stdio.h>
int main(void){
int num;
int e = 1;
int decimal = 0;
printf("%s\n", "Enter UNSIGNED BINARY! to convert decimal");
scanf("%d", &num);
int temp = num;
while (temp) {
int last = temp % 10;
temp = temp / 10;
decimal += last * e;
e = e * 2;
}
printf("%s %d\n", "Decimal: ", decimal);
return 0;
}