77. WAP to print binary of number in given range
#include<stdio.h>
void
main()
{
printf("WAP to print binary of
number in given range\n");
int i,j,n1,n2;
printf("Enter lower limit :
");
scanf("%d",&n1);
printf("Enter upper limit :
");
scanf("%d",&n2);
for(i=n1;i<=n2;i++)
{
printf("%d :: ",i);
for(j=31;j>=0;j--)
printf("%d",i>>j&1);
printf("\n");
}
}
Comments
Post a Comment