Це відео не доступне.
Перепрошуємо.
Learn C# for beginners: 35 - Useful Array Methods
Вставка
- Опубліковано 13 бер 2015
- If you enjoyed this video please comment below and give me a thumbs up! It goes a long way.
If you want to keep watching these videos make sure to subscribe!
You can contact me at:
Twitter: / jdprogramming
For business Inquires please email at: JDProgramming@Outlook.com
Wonderful way of teaching, very addictive.
Great tutorials, easy to understand very important topics made easy. Thanks.Those very fast learners, DO NOT MISS THE EXERCISES.
Do you believe it would be more efficient to first sort an array and use binary search, or to just use sequential search?
please make lectures on data structure using C#.
Do you have any videos on how to get the sum of even number in an a array elements and sum of odd number in an a array elements using for loops?
+Some Gurl Here you go,
int sumOfEven;
int sumOfOdd;
for (int number in array)
{
// Modulo operator is %, this divides number by 0 and returns the remainder
// If the remainder is zero, then it means the number is even
if((number % 2) == 0)
{
sumOfEven++; // Increment the even numbers
}
else
{
sumOfOdd++; // Increment the odd numbers.
}
}
Is this channel still active? Can you please help me with this problem
Create a C# program that asks the user for 10 real numbers then computes and displays the average of the numbers.
Hi Christian, no one will solve your problem like this. You have to try something and while trying if you face any problem, only then you can ask for help. I am also a beginner in C#. After seeing your comment, I tried to solve this. But I hope you find some motivation from me and start learning yourself!! Good luck!!!
static void Main(string[] args)
{
Console.WriteLine("Hit enter and type ten real numbers");
double[] realNumArray = new double[10];
double sum = 0;
double avg = 0;
for (int i = 0; i < realNumArray.Length; i++)
{
Console.WriteLine("Type real number {0}: ", i+1);
realNumArray[i] = double.Parse(Console.ReadLine());
sum += realNumArray[i];
}
avg = sum / (realNumArray.Length);
Console.WriteLine("The average of the real numbes is {0}", avg);
Console.ReadLine();
}
if anyone is curious like me and tried this, if you want to order the Array but get the result in reverse, do this:
//REVERSE THE ORDER IN ORDER
int[] myArray = { 10, 5, 7, 2, 55 };
Array.Sort(myArray);
for (int i = myArray.Length - 1; i >= 0; i--)
{
Console.WriteLine(myArray[i]);
}
i just Lesson 33's logic for this.. hope it helped someone!! :)