by Dinesh Thakur Category: C Programming (Pratical)

 

#include <stdio.h>
int main()
{
       int i=0;
       unsigned x=1;
       int intx=1;      /* added to original code so both can be seen at the same time*/
       clrscr();
         while (i <20)
           {
                printf("%8d:%8u:%8d\n",i,x,intx);
                /* %u is unsigned decimal format can only print as far as 2^14*/
                ++i;
                x *= 2;
                intx *= 2;
          }
               x= -1;
               printf("\n\nminus one = %8d%8u\n\n", x, x);
               /* x printed out as integer is -1 but as unsigned format prints 65535 */
               getch();
               return 0;

Compute Powers



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.