0
I want to add the sum of J in my project but i cant know how to do it please help me!
#include<iostream> #include<cmath> using namespace std; int main(){ string input; cin>>input; int lens =input.length(); int v=-1; int k; int j; int s; int a=0; for (int i=lens - 1; i>=0 ; --i){ int c=input[i]; k=(c%2)*2; v+=1; j=pow(k,v); cout<<"\nthis is k->"<<k<<"x"<<"this is v->"<<v<<"["<<j<<"]"<<"="<<j<<endl; } return 0; } This is the code Output you can see in the code which i have posted in my code in this question https://code.sololearn.com/cxA3x39ml5FI/?ref=app https://code.sololearn.com/cxA3x39ml5FI/?ref=app
2 Réponses
+ 1
What's is problem here actually? You already added sum..
0
But now the problem is solved