Advertisement
Guest User

Untitled

a guest
Sep 5th, 2015
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. namespace Helloworld
  2. {
  3.  
  4.  
  5.     class Program
  6.     {
  7.  
  8.         static void Main(string[] args)
  9.         {
  10.             string sz1;
  11.             char c;
  12.             int szamlalo = 0;
  13.  
  14.             Console.Write("Add meg a szöveget:");
  15.             sz1 = Convert.ToString(Console.ReadLine());
  16.             Console.Write("Add meg a keresett karaktert:");
  17.             c = Convert.ToChar(Console.ReadLine());
  18.  
  19.             foreach (char ch in sz1)
  20.             {
  21.                 if (ch == c)
  22.                 {
  23.                     szamlalo++;
  24.                 }
  25.             }
  26.             Console.WriteLine("a keresett karaktetek száma: " + szamlalo);
  27.  
  28.             Console.ReadKey();
  29.            
  30.            
  31.            
  32.  
  33.         }
  34.  
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement