Java Program to Check if Two Convex Regular Polygon Have Same Center or Not

bookmark

import java.util.*;
public class Main
{
   public static void main(String[] args)
   {
      //number of sides of both polygons are declared
      int m = 15;
      int n = 5;
      //check both polygons are having same center or not
      if(m%n == 0)
        System.out.println("Both the polygons have same center");
      else
        System.out.println("Both the polygons have not same center");
   }
}

 


Output:

Both the polygons have same center