Computer Science, asked by 2003varunp, 1 year ago

write a java program to convert first character of every word into uppercase (Need simple answers please!!)


Asna123: Can I send only the code
2003varunp: Sure

Answers

Answered by Asna123
3

Don't refer to that text book thing...refer only the written one

Attachments:

Asna123: Sentence is the one entered by u
Asna123: If at all it was helpful mark as brainliest
2003varunp: OMG!!! Thanks a lot!! I searched all over the internet, but they were all complicated. Thanks again!!
Asna123: 10th icse??
Asna123: Welcome
2003varunp: yes. one more thing. im getting syntax errors
2003varunp: can you please compile it and check?
Answered by mn121
2

import java.util.*;

public class case_change

{

   public static void main(String args[])

   {

       Scanner in = new Scanner(System.in);

       int l,i;

       String s,sn="",ch;

       System . out . println("Enter a sentence = ");

       s= in . nextLine();

       s = " "+s;

       l= s . length();

       for(i=0;i<l-1;i++)

       {

           if(s . charAt(i)==' ')

           {

               ch =""+s . charAt(i+1);

               sn = sn+ch . toUpperCase();

           }

           else

           sn = sn+s . charAt(i+1);

       }

       System . out . println(sn);

   }

}

please mark it as brainliest...

^_^


mn121: there is no spaces between the fullstop used in the program
mn121: i mean after and before... i have used because when i am clicking 'add your answer' .... it does not allow me to add the answer
Similar questions