Computer Science, asked by MeghnaRaj, 1 year ago

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 TishaM
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+".");
}
}
}
}
Similar questions