+ 2

What is the error?

#include <iostream> #include <math.h> using namespace std; int main() { int arr[5]; for(int i=0;i<5;i++){ arr[i]=i; } int p; p=arr[2]/2; arr[2]= (arr[3])^(pow(2,p)); cout<<arr[2]; return 0; } Can anyone explain plz why this code gave error I was practicing a contest problem in between this error occurred.

2nd Jul 2021, 10:48 AM
HK Lite
HK Lite - avatar
1 Answer
+ 2
Don't know what you're trying to do, but the issue is that binary operator between an int and a double. All i did was cast int to the double. Is this the expected output? idk https://code.sololearn.com/cKFc39HsLR6G/?ref=app
2nd Jul 2021, 10:55 AM
Slick
Slick - avatar