Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- using System.Collections;
- namespace Forum
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] str1 = { "Cat", "Dog", "Pig", "Horse", "Wolf", "Elephant" };
- Animal letter = new Animal();
- int res = letter.NumberOfRights(str1);
- Console.WriteLine("Letter \'a\' found {0}" ,res);
- Console.ReadLine();
- }
- }
- class Animal
- {
- public int NumberOfRights(string[]str1)
- {
- int number = 0;
- string compare = "a";
- foreach (var item in str1)
- {
- if (item.Contains(compare))
- {
- number++;
- }
- }
- return number;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement