Is this code correct. I want to find modulo where, n=10^9+7. <pre>MY CODE IS #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t,n,ans; cin>>t; while(t--) { cin>>n; ans = ((2%1000000007) * (pow(3,n)%1000000007))%1000000007; cout<<ans-1<<endl; } return 0; }
||=== Build file: "no target" in "no project" (compiler: unknown) ===| /home/jatin/programs/tri.cpp||In function ‘int main()’:| /home/jatin/programs/tri.cpp|16|error: invalid operands of types ‘__gnu_cxx::__promote_2<int, long long int, double, double>::__type {aka double}’ and ‘int’ to binary ‘operator%’| ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)