Write a program that reads the (x y) coordinates of 5 points
Answers
Answered by
1
Answer:
import java.util.Scanner;
public class GetInputFromUser
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int x[]=new int[5];
int y[]=new int[5];
for(int i=0;i<5;i++)
{
System.out.println("Enter x-cordinate of "+i+"th point");
int a = in.nextInt();
x[i]=a;
System.out.println("Enter y-cordinate of "+i+"th point");
a = in.nextInt();
y[i]=a;
}
System.out.println("Points are");
for(int i=0;i<5;i++)
System.out.println("("+x[i]+","+y[i]+")");
}}
Explanation:
Similar questions
English,
6 months ago
Math,
6 months ago
English,
6 months ago
Computer Science,
1 year ago
English,
1 year ago