Write a program in java to store ten country names with their capitals in 2 different single dimensional arrays. Display the country name along with its capital
in the format :
Country Name Capital
******* ************
Answers
Answered by
10
Answer:
public class Main
{
public static void main(String[] args) {
String []country={"ARGENTINA","BRAZIL","CANADA","CUBA","EGYPT","FRANCE","INDIA","ITALY","POLAND","SPAIN"};
String []capital={"BUENOS AIRES","BRASILIA","OTTAWA","HAVANA","CAIRO","PARIS","NEW DELHI","ROME","WARSAW","MADRID"};
int count=0;
while(count<10)
{
System.out.print(country[count]+" ");
System.out.print(capital[count]);
System.out.println();
count++;
}
}
}
Explanation:
Attachments:
Similar questions