Created
January 22, 2013 14:35
-
-
Save rajeevs1992/4595074 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#define SIZE(n) (n+8-(n%8))/8 | |
main() | |
{ | |
int upper,temp,i; | |
printf("Enter the largest number in list "); | |
scanf("%d",&upper); | |
upper+=1; | |
unsigned char list[SIZE(upper)]; | |
for(temp=0;temp<SIZE(upper);temp++) | |
list[temp]=0; | |
printf("\nEnter list "); | |
scanf("%d",&temp); | |
while(temp<upper) | |
{ | |
list[temp/8]=list[temp/8]|(1<<temp%8); | |
scanf("%d",&temp); | |
} | |
for(temp=0;temp<SIZE(upper);temp++) | |
for(i=0;i<8;i++) | |
if((list[temp]&(1<<i))!=0) | |
printf("%d\t",temp*8+i); | |
printf("\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment