Can you tell me how do it. I tried searching on the internet but no success.

Here is an example for my code. Can you convert this for me.

Code:

/* This program converts the decimal value into a binary value,
* along with displaying number of 1 in the result and how
* long the 1's sequence is continous.
*/
#include <stdio.h>
// Declaring Variables
int x = 0;
int y = 0;
int z = 0;
int a = 0;
int b = 0;
int c = 0;
int dec_num; // Input for the decimal number from the user.
int count= 0; // Varibale for counting 1s
int dec[64]; // Random Value for storing numbers in an Array
/*
* Method where user is asked to enter an integer
* and it is converted into an binary digits.
*/
int main(void)
{
printf("Enter a decimal integer: "); // Asking user for an Integer.
scanf("%d", &dec_num); // Reading the inputted Interger Value
if(dec_num < 0){ // Finding any Negative Number.
printf("\n NEGATIVE NUMBER\n"); // Negative Number cannot work.
return 0; // Program Closed
}
while(dec_num !=0) // If number is more than 0, prog will work.
{
dec[x] = dec_num%2; // Mod calculation where remainder is chosen.
dec_num = dec_num/2; // Divind the number by 2 to make it into binary.
x++; // Incrementing, where remainder is taken.
}
printf("Binary representation = "); // Displaying the final result, Binary Value of an Integer.
for(a = x-1; a>=0; a--) // Only numbers 0 and 1 are taken, rest are calculated again.
{
printf("%d", dec[a]);// Result
}
printf("\n"); // New Line.
for(y=0; y<=x; y++) // Finding number of 1s in the answer.
{
if(dec[y] == 1) // If any results have 1, then it is taken into a array.
{
count++; // Added to an Array
}
}
printf("No. of 1's in the binary representation = %d \n", count); // Displaying number of ones in the Binary Value.
for(c = 0; c <= x; c++) // Calculating the longest sequence of 1, block.
{
if(dec[c] == 1) // Finding where the 1 is located in the result.
{
z++;// Increases the block size when they are 1s in continous.
}
else if(z > b) // If its more than 1,
{
b = z;// then it is set to the count
z = 0;// and set that to 0.
}
else
{
z = 0;// Set to 0 for same reasons as above.
}
}
printf("Maximum block length = %d \n", b); // Displays the longest block for 1s in a sequence.
return 0; // TO END THE PROGRAM
}// THE END..........