Created
February 11, 2015 19:49
-
-
Save shohan4556/fec603214b63a2d17ec2 to your computer and use it in GitHub Desktop.
euler 48 solution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Euler problem 48 | |
| #include<stdio.h> | |
| #include<math.h> | |
| int long long power(int long long n); | |
| int main() | |
| { | |
| int long long ans,i,j; | |
| ans=0; | |
| for(i=1;i<=1000;i++){ | |
| ans= ans+power(i); | |
| ans=ans%10000000000; | |
| } | |
| printf("ans :%lld",ans); | |
| return 0; | |
| } | |
| int long long power(int long long n) | |
| { | |
| int i; | |
| int long long p=1; | |
| for(i=1;i<=n;i++){ | |
| p=p*n; | |
| p=p%10000000000; | |
| } | |
| return p; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment