Subdomain Posts
C++ | 8 hours ago
C++ | 9 hours ago
C | 9 hours ago
C++ | 10 hours ago
C | 3 days ago
C | 5 days ago
C | 5 days ago
C | 5 days ago
SQL | 5 days ago
C | 6 days ago
Recent Posts
C | 31 sec ago
None | 35 sec ago
None | 1 min ago
HTML | 1 min ago
None | 1 min ago
None | 1 min ago
PHP | 2 min ago
None | 2 min ago
None | 2 min ago
None | 2 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Anonymous on the 3rd of Feb 2010 10:45:28 AM Download | Raw | Embed | Report
  1. include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(int argc, char **argv) {
  5.         /* Read the single command line argument and convert it
  6.          * to an integer.
  7.          */
  8.         if (argc != 2) {
  9.                 fprintf(stderr,"Usage is %s <number>\n", argv[0]);
  10.                 exit(1);
  11.         }
  12.         const unsigned int n = atoi(argv[1]);
  13.  
  14.         unsigned int p;
  15.         for (p = 1; p <= n; p = p << 1) {}
  16.  
  17.         for (p = p >> 1; p > 0; p = p >> 1)
  18.         {
  19.  
  20.                 if ((p & n) == p)
  21.                         putchar('1');
  22.                 else
  23.                         putchar('0');
  24.  
  25.         }
  26.  
  27.         putchar('\n');
  28.         return 0;
  29. }
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: