Write a C# Sharp program to create a new list of the rightmost digits from a given list of positive integers
- برمجة سي شارب
- برمجة
- 2021-05-17
- MarwaMohammed
الأجوبة
using System;
using System.Collections.Generic;
using System.Linq;
namespace exercises
{
class Program
{
static void Main(string[] args)
{
List<int> mylist = test(new List<int>(new int[] { 10, 22, 35 , 41 }));
foreach(var i in mylist)
{
Console.Write(i.ToString()+" ");
}
}
public static List<int> test(List<int> nums)
{
IEnumerable<int> digits = nums.Select(x => x % 10);
return digits.ToList();
}
}
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
