Computer Science, asked by allgameplaybrothers1, 4 months ago

Write a program to input a sentence and convert into uppercase and display each word in the separate line

Example: input: India is my country

output: INDIA

IS

MY

COUNTRY​

Answers

Answered by ramiitacademy
49

Answer:

import java.util.*;

class india

{

public static void main(String args[])

{

Scanner s=new Scanner(System.in);

int length;

char tmpchar;

System.out.println(" Enter a Sentence ");

String sent1=s.nextLine();

length=sent1.length();

String sent2=sent1.toUpperCase();

for(i=0; i<length; i++)

{

tmpchar=sent2.charAt(i);

if(tmpchar==' ')

System.out.print("\n);

else

System.out.print(tmpchar);

}

}

}

Hope it will help you

from

Guramrit Pal Singh

Attachments:
Answered by henkeshp321
6

⇒ see down I have given the page link

Attachments:
Similar questions