Answer:
import java.util.*;
public class Country
{
public static void main(String args[])
{
char ch,temp;
int flag = 0;
String country;
ArrayList<String> countries = new ArrayList<String>();
Scanner sc = new Scanner(System.in);
do
{
System.out.println("enter the country you have visited:\t");
country = sc.next();
for(int i=0;i<countries.size();i++)
{
if(countries.get(i).equals(country))
{
System.out.println("you have already entered the country");
flag = 1;
break;
}
}
if(flag == 0)
{
countries.add(country);
flag = 0;
}
System.out.println("want to add another country(y/n):\t");
ch = sc.next().charAt(0);
}while(ch!='n');
Collections.sort(countries);
System.out.println("Countries you have visited:\t"+countries);
System.out.println("Total number of contries visited:"+countries.size());
}
}
Explanation:
Answer:
operating system
Explanation:
There are a lot of operating systems in the market. Ubuntu, red hat, windows, apple Macintosh etc. The choice of an operating system changes all the version of software used in the system. Therefore, while choosing a computer one must be aware of the operating system used in it.
Answer:
pancakes = int(input("Enter number of pancakes "))
if pancakes>3:
print("Yum!")
else:
print("Still hungry!")
Explanation:
It is a very simple program in python programming language
The input function is used to prompt user to enter a value for the variable pancakes
Using if and else constructs the program outputs Yum! or Still Hungry