Write a program to accept a sentence and print only the first letter of each word of the sentence in capital letters separated by a full stop.
Answers
Answered by
3
class Abc
{
public static void main(String s)
{
s=" "+s;
int l=s.length();
for(int i=0;i<l; i++)
{
char t = s.charAt(i);
if(t==' ')
{
char b= s.charAt(i+1);
if(b>='a'&& b<='z')
b-=32;
System.out.print(b+".");
}
}
}
}
{
public static void main(String s)
{
s=" "+s;
int l=s.length();
for(int i=0;i<l; i++)
{
char t = s.charAt(i);
if(t==' ')
{
char b= s.charAt(i+1);
if(b>='a'&& b<='z')
b-=32;
System.out.print(b+".");
}
}
}
}
Similar questions
Science,
8 months ago
Math,
8 months ago
Math,
8 months ago
Social Sciences,
1 year ago
Social Sciences,
1 year ago
Math,
1 year ago
Music,
1 year ago