Skip to content

TRUEANGLE

BEAUTY AND PLAY

  • DOLLECT
  • Others
  • Configuration
  • AI
  • BLOG
  • ABOUT
    • ABOUT
    • Perception Style

Daily Archives: June 23, 2014

How to write a program to find if a number is a power of 2 ?

/* determining if an integer is a power of 2 */ #include <stdio.h> int main() { unsigned int v; /* we want to see if v is a power of 2 */ typedef int bool; bool f; printf(“enter number”); scanf(“%d”,&v); f = ( v & ( v – 1) ) == 0; printf(“the result is …

Continue reading “How to write a program to find if a number is a power of 2 ?”

Posted byjeffrinJune 23, 2014Posted inC, mathematics, Programming Languages
June 2014
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« May   Jul »
TRUEANGLE, Proudly powered by WordPress.