Sunday, 12 January 2020

HAY THANK FOR VISIT


Question:-Store the name of 10 countries and tgheir correspoinding capital in turn reaspectively . input the name of the country and search.

import java.util.*;
class Country
{
    void main()
    {
        Scanner sc=new Scanner(System.in);
        String name[]={"india","pakistan","afganistan","australia","canada","germany","france","nepal","iran","iraq"};
        String cap[]={"new delhi","Islamabad","kabul","canberra","ottawa","berlin","paris","kathmandu","tehran","baghdad"};
        System.out.println("entre the name of country");
        String n=sc.nextLine();
        n=n.toLowerCase();
        
        for(int i=0;i<10;i++)
       {
          if(n.equals(name[i]))
          {
              System.out.println(n+"="+cap[i]);
            }
        }
    }

}

No comments:

Post a Comment

HAY THAKYOU FOE VISIT

Program(python):-Find duplicates in an array (Geeks for geek problem)

QUESTION:- Given an array  a  of size  N  which contains elements from  0  to  N-1 , you need to find all the elements occurring more than o...