+ 1

I made this correctly, still it shows error. Idk why?

#include <iostream> using namespace std; int main() { cout<<"enter the limit\n"; int i,N,s=0,A[100]; cin>>N; cout<<"Enter an array of "<<N<<" values\n"; for(i=0;i<N;i++) { cin>>A[i]; } for(i=0;i<N;i++) { if(A[i]%2==0) s+=A[i]; } cout<<"Sum of even no ="<<s; return 0; }

6th Jan 2020, 8:05 AM
Funky_insider
Funky_insider - avatar
5 odpowiedzi
0
It's working fine for me...
6th Jan 2020, 8:16 AM
Jayakrishna 🇮🇳
+ 2
It's perfectly alright. The only problem I think you would be facing would either because of your internet connection OR you are not giving the input correctly, if you are using it on code playground. (In code playground you have to give all the input at once and each input should be seperated by a newline character ("carriage return"on your keyboard))
6th Jan 2020, 8:33 AM
Arsenic
Arsenic - avatar
0
I compiled it here on solocode. It doesn't make any sense compiling our codes here I think so
6th Jan 2020, 9:40 AM
Funky_insider
Funky_insider - avatar
0
May be, it support as above Arsenic specified. That is the only difference with other compilers.. And also if you are not using readLine methods, you can give input with a space separated. Ex: for your program input : 4 2 3 8 9 Output you get 10
6th Jan 2020, 10:38 AM
Jayakrishna 🇮🇳
0
C++
6th Jan 2020, 11:27 PM
David Toba
David Toba - avatar