FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cprogram/Binary_to_decimal_conversion at master · seeditsolution/cprogram · GitHub
seeditsolution
cprogram
Repository navigation
Code
Issues
12
(12)
Pull requests
572
(572)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cprogram
/
Binary_to_decimal_conversion
Copy path
More file actions
More file actions
Latest commit
History
History
History
20 lines (18 loc) · 444 Bytes
Breadcrumbs
cprogram
/
Binary_to_decimal_conversion
Copy path
File metadata and controls
20 lines (18 loc) · 444 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <math.h>
int main()
{
int decimalnum = 0, temp = 0, remainder;
long binarynum;
printf("Enter a binary number: ");
scanf("%ld", &binarynum);
while (binarynum!=0)
{
remainder = binarynum % 10;
binarynum = binarynum / 10;
decimalnum = decimalnum + remainder*pow(2,temp);
temp++;
}
printf("Equivalent decimal number is: %d", decimalnum);
return 0;
}
Back
|
FazBrowse Home
|
New Git URL