how to convert integer to decimal

Program

#include<stdio.h>
#include<conio.h>
void main(void)
{
         int n,c,k;
         printf("\n Enter a integer in decimal:");
         scanf("%d",&n);
         printf("\n %d in binary:",n);
         for(c=31;c>=0;c--)
         {
                 k=n>>c;
                 if(k&1)
                 printf("1");
                 else
                 printf("0");
         }
         printf("\n");
}

Comments

  1. This comment has been removed by the author.

    ReplyDelete
  2. This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again. hex To decimal Online convertor

    ReplyDelete

Post a Comment

Popular posts from this blog

Stack

EXTRA INFORMATION ABOUT TECHNOLOGY