import java.io.*;
class ascii
{
public static void main(String[] args)throws Exception
{
DataInputStream input = new DataInputStream (System.in);
System.out.println("Nama : Ainul Masyayikh");
System.out.println("npm : 06.2009.1.04662");
System.out.println("--------------------------");
System.out.print("Masukkan kata = ");
String kata = input.readLine();
System.out.print("Masukan huruf : ");
String b = input.readLine();
if (b.length()==1)
{
char b2 = b.charAt(0);
char u;
for (int i=0; i<=kata.length()-1; i++)
{
u=kata.charAt(i);
if (u==b2)
{
System.out.println("urutan ke-"+(i+1));
}
}
}else
{
System.out.println("satu huruf saja");
}
}
}
class ascii
{
public static void main(String[] args)throws Exception
{
DataInputStream input = new DataInputStream (System.in);
System.out.println("Nama : Ainul Masyayikh");
System.out.println("npm : 06.2009.1.04662");
System.out.println("--------------------------");
System.out.print("Masukkan kata = ");
String kata = input.readLine();
System.out.print("Masukan huruf : ");
String b = input.readLine();
if (b.length()==1)
{
char b2 = b.charAt(0);
char u;
for (int i=0; i<=kata.length()-1; i++)
{
u=kata.charAt(i);
if (u==b2)
{
System.out.println("urutan ke-"+(i+1));
}
}
}else
{
System.out.println("satu huruf saja");
}
}
}
Tidak ada komentar:
Posting Komentar