Advertisement
Pavle_nis

C# Console App1

Oct 10th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. string[] niz = new string[30];
  2.             int x;
  3.  
  4.             Console.WriteLine("Unesite reč:");
  5.             string s = Console.ReadLine();
  6.  
  7.             for (int i = 0; i < s.Length; i++)
  8.             {
  9.                 x = 0;
  10.                 for (int j = 0; j < s.Length; j++)
  11.                 {
  12.                     if (s[i] == s[j])
  13.                     {
  14.                         x++;
  15.                         niz[i] = s[i] + " - " + x.ToString() + "\n";
  16.                     }
  17.                 }
  18.             }
  19.  
  20.             for (int i = 0; i < niz.Length; i++)
  21.                 Console.WriteLine(niz[i]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement