Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created February 11, 2015 19:48
Show Gist options
  • Select an option

  • Save shohan4556/1b371f4d252900659cb3 to your computer and use it in GitHub Desktop.

Select an option

Save shohan4556/1b371f4d252900659cb3 to your computer and use it in GitHub Desktop.
#include<stdio.h>
#include<math.h>
// a. find out p=2^15
// b. print the last digit of p
int main()
{
int ans,i,n,j;
n=10;
ans=2;
for(i=2;i<=15;i++){
ans=ans*2;
ans=ans%10; // if I want to know the last one digit of the number of the sum of the sequence
}
printf("ans :%d",ans);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment