Question 7.
Write a Java program to input a sentence from the user and display the words which contain the
alphabet 'A' in them in either Lowercase or Uppercase.
Sample Input : All is well that ends well.
Sample Ouptut : All
th
Answers
Answered by
5
◼The main parts of a programming is initialization, condition, and updating.
◼Variables are the memory location which stores certain value either during coding or during execution of the program.
◼The condition works with the variables .If the following conditions will be true then the statement under it will execute.
◼Updating is the change in the values of variables after or before each checking of the condition.
◼Following programming is done by i o package of Java language.
import Java. io. *;
class check
{
public static void main(String args[]) throws Exception
{
(initializing )
Stri ng s, s1="";
int i ,j ;
char ch, c;
DataInputStream in = new DataInputStream(System.in);
(Inputing)
System. out. println("Enter any sentence ");
s=in.readLine();
(condition)
for (i=0;i<s.length();i++)
{
ch=s . charAt(i);
if(ch !=" ")
s1= s1 + ch;
if(ch = " " )
{
for(j=0; j<s1.length() ;j++)
{
c=s1 . charAt(j)
if(c == "A"|| c=="a")
System. out. print( s1 +" ,");
}
s1="";
}
}
}
Enter any sentence
s=My name is naina .
▶name
▶naina
Answered by
0
Explanation:
pls mark me as a brainlist guys
Attachments:
Similar questions
India Languages,
6 months ago
Math,
6 months ago
CBSE BOARD XII,
6 months ago
English,
11 months ago
India Languages,
11 months ago
Math,
1 year ago
Chemistry,
1 year ago