TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jon Smit
NA
6
1.8k
assigning new array to the array passed by reference
Dec 16 2018 8:33 AM
write a OddNumbers method,The method should take an integer array passed using the ref keyword.
After the method is executed the array that was passed in should retain contain only the even numbers in the same order, and should have no space free
using System;
namespace HelloWorld
{
class Program
{
static string GetArrayAsString(int[] array)
{
if(array.Length == 0) return "";
string str = "";
int i = 0;
for(; i < array.Length - 1; i++)
{
str += array[i] + ", ";
}
str += array[i];
return str;
}
static void Main(string[] args)
{
int[] array = { 3, 8, 12, 31, 5, 78, 90 };
removeOddNumbers(ref array);
Console.WriteLine(GetArrayAsString(array));
}
}
}
Reply
Answers (
1
)
Convert Row data into column against one id
When check in in tfs file it not included on project on sour