Draw a flowchart to input a name and print “The name is Kabir” if the input is Kabir, and print “The name is Sameer” if the input is Sameer. Write an apt default condition too.
Answers
Answered by
4
Answer:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter name:");
String name = scanner.nextLine();
if(name.equalsIgnoreCase("Kabeer"))
System.out.println("The name is Kabeer");
else if(name.equalsIgnoreCase("Sameer"))
System.out.println("The name is Sameer");
else
System.out.println("The name is " + name);
}
}
Explanation:
Similar questions
Social Sciences,
16 hours ago
English,
16 hours ago
English,
16 hours ago
Economy,
1 day ago
Physics,
1 day ago
Geography,
8 months ago
Social Sciences,
8 months ago