Skip to content

Instantly share code, notes, and snippets.

@officialcjunior
Last active July 1, 2020 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save officialcjunior/bb51a329816dd6f626ea35f796d55e02 to your computer and use it in GitHub Desktop.
Save officialcjunior/bb51a329816dd6f626ea35f796d55e02 to your computer and use it in GitHub Desktop.
A program to find the powers of two using bits, without a loop or any other functions.
#include <stdio.h>
int main ()
{
int n, val;
printf("Enter the value for n \n");
scanf("%d",&n);
printf("2^%d is %d \n",n,2<<(n-1));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment