- 1

Create a program to output the sum of 2 numbers???

What is wrong with this code? Any one to tell please?

7th Aug 2022, 2:16 PM
Abdisa Simie Alemu
Abdisa Simie Alemu - avatar
12 Réponses
+ 2
Where is your code?
7th Aug 2022, 2:19 PM
Jayakrishna 🇮🇳
+ 1
It is a program for finding sum of even numbers from array of 5 numbers..! Not for just some of 2 numbers!!!
7th Aug 2022, 2:22 PM
Jayakrishna 🇮🇳
+ 1
What? For what, you running it? even sum or sum of 2? It's runs fine. Did you tried? What is the error?
7th Aug 2022, 2:34 PM
Jayakrishna 🇮🇳
+ 1
ABDISA SIMIE ALEMU declare sum before for loop as int sum = 0; Then it's runs fine. On pop up window: give input like: 3 (enter) 4 (enter) 5 (enter) 4 (enter) 8 (submit) Output: 16
7th Aug 2022, 3:02 PM
Jayakrishna 🇮🇳
+ 1
Def sum(a,b): return a+b Eaaasy
9th Aug 2022, 12:55 PM
abdeljalil angri
abdeljalil angri - avatar
0
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int[] numbers = new int[5]; int count = 0; while (count <5) { numbers[count] = Convert.ToInt32(Console.ReadLine()); count++; } for(int i=0;i<numbers.Length;i++){ if(numbers[i]%2==0) sum += numbers[i]; } Console.WriteLine(sum); } } }
7th Aug 2022, 2:20 PM
Abdisa Simie Alemu
Abdisa Simie Alemu - avatar
0
Yes yes ahhh
7th Aug 2022, 2:25 PM
Abdisa Simie Alemu
Abdisa Simie Alemu - avatar
0
Why don't it run?
7th Aug 2022, 2:26 PM
Abdisa Simie Alemu
Abdisa Simie Alemu - avatar
0
Eee?
7th Aug 2022, 2:28 PM
Abdisa Simie Alemu
Abdisa Simie Alemu - avatar
0
Even sum
7th Aug 2022, 2:38 PM
Abdisa Simie Alemu
Abdisa Simie Alemu - avatar
0
Are you looking for Recursive or Non recursive?
8th Aug 2022, 3:39 PM
sree harsha
sree harsha - avatar
0
who can help me learn to program, can you give me your phone number?
8th Aug 2022, 11:58 PM
Julio