WAP to input a string and display it in the manner shown below:
I/P: APPLE
O/P:A$P$P$L$E$
Answers
Answered by
1
Question:-
Write a program to input a string and display the string in following manner.
Input:- APPLE
Output:- A$P$P$L$E$
Program:-
import java.util.*;
class StringExample
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter the string: ");
String s=sc.next(),n="";
for(int j=0;j<s.length();j++)
n+=s.charAt(j)+"$";
System.out.println("Resultant String: "+n);
}
}
Answered by
1
Answer:
I have pinned the answer image you can check it out dear
Hope you may get it
Mark as brainliest
Thank You...
Attachments:
Similar questions
History,
3 months ago
Computer Science,
3 months ago
English,
3 months ago
Math,
6 months ago
English,
6 months ago
Psychology,
11 months ago
Math,
11 months ago