Computer Science, asked by SidhuDhoni4532, 1 year ago

Write a program that inputs the number of sides of a polygon and determines whether it is a hexagon and Pentagon a rectangle or a triangle

Answers

Answered by alphacoder
4
int sides;
String polygon;

if (sides == 3) {
   polygon = "Triangle";
} else if (sides == 4) {
  polygon = "quadrilateral";
} else if (sides == 5) {
  polygon = "pentagon";
} else if (sides == 6) {
  polygon = "hexagon";
}
Similar questions