Computer Science, asked by pMahajan2863, 11 months ago

Write a program that reads the (x y) coordinates of 5 points

Answers

Answered by sswaraj04
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