0

Can anyone tell me where i am wrong??

https://www.sololearn.com/coach/63?ref=app #include <stdio.h> int main() { int a,n,sum=0,i; printf("enter the list of integer %d\n",a); scanf("%d",&a); for(n=1;n<=a;n++) { { printf(" %d\n",n); } } for(i=1; i<=n; i++) { if((i%2==0)&&(i<=a)) sum=sum+i; } printf("Sum of all Even Integers is %d\n",sum); return 0; } This is my code.. But when i am going to run this,it doesn't show result according to testcases..plz help me...

23rd May 2021, 7:57 PM
Learner
4 odpowiedzi
+ 2
Prajakta Code Couches doens't accept any output except final result so don't print anything except your result. You have to take multiple input and calculate sum if number is even so you can just do this: int a, sum = 0; for (int n = 0; n < a; n++) { cin >> a; if (a % 2 == 0) sum += a; } cout << sum;
24th May 2021, 2:05 AM
A͢J
A͢J - avatar
0
code coaches should only have necissary output. I'm not sure about the logic yet, but you should comment out the printf lines
23rd May 2021, 8:28 PM
Slick
Slick - avatar
0
Ok..thanx
23rd May 2021, 8:46 PM
Learner
0
No worries! Comment back if it doesn't work
23rd May 2021, 8:47 PM
Slick
Slick - avatar