package PengandaiIF;
import java.io.*;
public class membalikanKarakter {
public static void main(String[] args) throws IOException {
DataInputStream entri = new DataInputStream(System.in);
int x, i;
String st;
System.out.print("Inputkan kata atau kalimat : ");
st = entri.readLine();
x = st.length();
for (i=0;i<x;i++) {
if(i==0)
System.out.println("Huruf awal : "+st.charAt(i));
if(i==x-1)
System.out.println("Huruf akhir: "+st.charAt(i));
}
System.out.print("Kata setelah dibalik : ");
for (i=x-1;i>=0;i--){
System.out.print(st.charAt(i));
}
}
}
Output :
Ada makna baik yang tersirat ketika source code tidak bisa di copy.
0 Komentar
Keep Learning and Keep Sharing