Write a C# Sharp program to indicate whether each string in an array ends with a period (".")
-
2021-05-30
- | ahmadghneem
- | م201
Write a C# Sharp program to indicate whether each string in an array ends with a period (".").
Expected Output :
'Actions speak louder than words' ends in a period: False 'Hello!' ends in a period: False 'Python.' ends in a period: True 'PHP.' ends in a period: True 'random' ends in a period: False
الأجوبة
ابحث عن مسائل برمجة سي شارب | c# programming بالانجليزي
using System;
public class Example41
{
public static void Main()
{
String[] strings = { "Actions speak louder than words", "Hello!", "Python.",
"PHP.", "random" };
foreach (var value in strings) {
bool endsInPeriod = value.EndsWith(".");
Console.WriteLine();
Console.WriteLine("'{0}' ends in a period: {1}",
value, endsInPeriod);
}
}
}
-
2021-05-30
- | ahmadghneem
- | إبلاغ عن إساءة
أسئلة مشابهة