+ 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; }
5 Respostas
0
It's working fine for me...
+ 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))
0
I compiled it here on solocode. It doesn't make any sense compiling our codes here I think so
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
0
C++