static void Zad5(){
char[] napis={'A','l','a',' ','m','a',' ','k','o','t','a'};
int ile=0;
for(int i='A'; i<'Z'; i++) {
ile=0;
for (int j = 0; j < napis.length; j++)
if (napis[j] == i)
ile++;
if(ile>0)
System.out.println((char)i + " Wystepuje " + ile + " razy");
}
for(int i='a'; i<'z'; i++) {
ile=0;
for (int j = 0; j < napis.length; j++)
if (napis[j] == i)
ile++;
if(ile>0)
System.out.println((char)i + " Wystepuje " + ile + " razy");
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter