- 1
Create a program to output the sum of 2 numbers???
What is wrong with this code? Any one to tell please?
12 Réponses
+ 2
Where is your code?
+ 1
It is a program for finding sum of even numbers from array of 5 numbers..!
Not for just some of 2 numbers!!!
+ 1
What?
For what, you running it? even sum or sum of 2?
It's runs fine. Did you tried? What is the error?
+ 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
+ 1
Def sum(a,b):
return a+b
Eaaasy
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);
}
}
}
0
Yes yes ahhh
0
Why don't it run?
0
Eee?
0
Even sum
0
Are you looking for
Recursive or
Non recursive?
0
who can help me learn to program, can you give me your phone number?