0

I am writing a program for the code coach challenge but my all first three result are ok but test case 4,5 are not ok

#include <iostream> using namespace std; int main() { int i; int a; int c; cin>>i>>a>>c; char fat=i%2; char cat=a%2; char car=c%2; if(fat==0&&cat==0&&car==0){ cout<<i+a+c; } else if(fat>=1&&cat==0&&car==0){ cout<<a+c; } else if(fat==0&&cat>=1&&car==0){ cout<<i+c; } else if(fat==0&&cat==0&&car>=1){ cout<<i+a; } else if(fat>=1&&cat==0&&car>=1){ cout<<a; } else if(fat>=1&&cat>=1&&car==0){ cout<<c; }else if(fat==0&&cat>=1&&car>=1){ cout<<a;} else if(cat=='\0'){ for(i=0;i>=cat;--i){ int c=i; if(c%2==0){ cout<<"0"; } }} return 0; } That's odd... +50 XP You want to take a list of numbers and find the sum of all of the even numbers in the list. Ignore any odd numbers. Task: Find the sum of all even integers in a list of numbers. Input Format: The first input denotes the length of the list (N). The next N lines contain the list elements as integers. Please help me!!!

29th Jul 2020, 12:39 PM
Harsh Sharma
Harsh Sharma - avatar
9 ответов
29th Jul 2020, 12:48 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
I have posted the question help me!!!!
29th Jul 2020, 12:43 PM
Harsh Sharma
Harsh Sharma - avatar
+ 1
Why are you taking input integer (if it is that's odd)?
29th Jul 2020, 12:46 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
Yes i see i will try my best to resolve it
29th Jul 2020, 12:49 PM
Harsh Sharma
Harsh Sharma - avatar
+ 1
Thank you for your help
29th Jul 2020, 12:49 PM
Harsh Sharma
Harsh Sharma - avatar
31st Jul 2020, 4:09 AM
naresh
naresh - avatar
0
So what to do
29th Jul 2020, 12:46 PM
Harsh Sharma
Harsh Sharma - avatar
0
The user will tell you first how many input you have to take. Then depends on the user giving output you will take input.
29th Jul 2020, 12:49 PM
The future is now thanks to science
The future is now thanks to science - avatar
0
Yes it help me thank you
31st Jul 2020, 4:34 AM
Harsh Sharma
Harsh Sharma - avatar