Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Helloworld
- {
- class Program
- {
- static void Main(string[] args)
- {
- string sz1;
- char c;
- int szamlalo = 0;
- Console.Write("Add meg a szöveget:");
- sz1 = Convert.ToString(Console.ReadLine());
- Console.Write("Add meg a keresett karaktert:");
- c = Convert.ToChar(Console.ReadLine());
- foreach (char ch in sz1)
- {
- if (ch == c)
- {
- szamlalo++;
- }
- }
- Console.WriteLine("a keresett karaktetek száma: " + szamlalo);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement