Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement