Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- void BinaryString(int iVal) {
- int i = 0;
- int bin = 0;
- int cas = 0;
- while (iVal != 0) {
- int x = iVal & 1;
- bin += (x * pow(10, cas));
- cas++;
- iVal = iVal >> 1;
- i++;
- }
- printf("%d\n", bin);
- }
- int main(void) {
- int integerValue;
- scanf("%d", &integerValue);
- BinaryString(integerValue);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement