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

2nd Aug 2020, 4:14 PM
Harsh Sharma
Harsh Sharma - avatar
2 odpowiedzi
+ 1
What's is problem here actually? You already added sum..
2nd Aug 2020, 6:12 PM
Jayakrishna 🇮🇳
0
But now the problem is solved
2nd Aug 2020, 6:15 PM
Harsh Sharma
Harsh Sharma - avatar