78. WAP to print first [X] binary format of number starting from given input
#include<stdio.h>
void
main()
{
printf("WAP to print first [X]
binary format of number starting from given input \n");
int i,j,n1,n2,c;
printf("Enter the number :
");
scanf("%d",&n1);
printf("Enter how many numbers
binary required : ");
scanf("%d",&n2);
for(i=n1,c=1;c<=n2;i++)
{
printf("%d :: ",i);
for(j=31;j>=0;j--)
printf("%d",i>>j&1);
printf("\n");
c++;
}
}
Comments
Post a Comment