write a c program that takes a binary file as input and finds error check using different mechanisms.
write a c++ program to convert binary number to decimal number by using while statement
#include<stdio.h> void main() { int n; clrscr(); printf("enter a no."); scanf("%d",&n); if(n%10==0n%10==1) printf("yes binary"); else printf("not binary"); getch(); } }
This is not a perfect program, but it will get you started in the right direction. Works for any INTEGER up to "some" power of 2 (decimals kill the program). PROGRAM binary IMPLICIT NONE INTEGER remainder, quotient, n, int_input, answer REAL input, dec_input WRITE(*,*) 'Input a number to convert to binary' READ(*,*) input int_input = input dec_input = input - int_input dec_input = abs(dec_input) quotient = abs(input) DO WHILE (dec_input==0) n = 0 answer = 0 DO WHILE (quotient>1) remainder = mod(quotient,2) quotient = quotient/2 answer = answer+remainder*10.**n n = n+1 END DO IF (input<0) answer = -answer answer = answer + quotient*10.**n WRITE(*,"(a,i31)") 'Your answer in binary is:',answer END DO END PROGRAM binary
The lower-level the language, the harder it is to write programs in. It takes a long time to write a program in machine language...and it is way more trouble than writing it in an abstracted language.
To convert a decimal number to binary in Verilog, you can use the built-in reg or wire types to store the binary value. First, define a module and declare an input for the decimal number. You can then use an assignment statement to convert the decimal to binary by assigning the input directly to the output, as Verilog implicitly handles the conversion. For example: module decimal_to_binary(input [7:0] decimal, output reg [7:0] binary); always @(*) begin binary = decimal; // Implicit conversion from decimal to binary end endmodule This code will take an 8-bit decimal input and output its binary representation.
networking
write a c++ program to convert binary number to decimal number by using while statement
to implement operations on binary heap in c
#include<stdio.h> void main() { int n; clrscr(); printf("enter a no."); scanf("%d",&n); if(n%10==0n%10==1) printf("yes binary"); else printf("not binary"); getch(); } }
How is this a question? Sounds like you should do more of your homework offline.
Decimal 18 is 10010 in binary
Decimal 23 is 10111 in binary
Decimal 26 is 11010 in binary
Decimal 27 is 11011 in binary
11001 16 + 8 + 1
Decimal 20 is 10100 in binary
Decimal 28 is 11100 in binary