Pythagoras n-sided Polygon with Natural Numbers using Programming Language

Page 1

International Research Journal of Engineering and Technology (IRJET)

e-ISSN: 2395-0056

Volume: 04 Issue: 07 | July -2017

p-ISSN: 2395-0072

www.irjet.net

Pythagoras n-sided polygon with Natural Numbers using Programming Language S.N.R.G. Bharat Iragavarapu 1, Kuppili Sai Rahul 2 1Assistant

Professor, Department of Mathematics GVP College of Engineering (Autonomous), Visakhapatnam, AP, India 2 B.Tech Student, Department of Electronics and Communication Engineering GVP College of Engineering (Autonomous), Visakhapatnam, AP, India ---------------------------------------------------------------------***---------------------------------------------------------------------

Abstract - In this paper, using computer programming

language Java we determine the Pythagoras n-sided polygon for any (n-1) natural numbers and this Pythagoras n-sided polygon satisfies the extension of the Pythagoras theorem i.e the sum of the squares of the first (n-1) side lengths is equal to the sum of the square of the nth side length. Key Words: Pythagoras theorem, Triangle, Quadrilateral, Polygon, Pythagoras n-sided polygon

1. INTRODUCTION

Step 10: Using another for loop, calculate sum of squares of all the entered numbers. Step 11: Calculate first element of second array arr2[0] as {(2*arr1[0]*arr1[0])-sum} . Step 12: If arr2[0] is positive go to step 13, else, go to step 13. Step 13: Multiply arr2[0] with -1 and go to step 14. Step 14: Calculate the remaining elements of arr2[i] as

In [1, 2, 3, 4, 5, 6 ] the authors developed extension of Pythagoras theorem for 4, 5, 6, 7, 8, 9 sided polygons using programming language C. But, for a polygon with sides more than10 this process is difficult using programming language C.

(2*arr1[i]*arr1[0]) except the last element. Step 15: Assign the value sum for arr2[n-1]. Step 16: Use another for loop to print the elements of arr2[]. Step 17: Print the statement “Entered number of sides can’t form a polygon.”

In this paper we developed a program using programming language Java for formation of an n-sided polygon when (n-1) natural numbers are provided. This nsided polygon satisfies the Pythagoras theorem.

Step 18: Stop.

2. MAIN RESULT

Step 1: Enter number of sides of your polygon.

2.1 Algorithm

Step 2: Enter any (n-1) natural numbers.

2.2 Result Analysis

Step 3: It displays the side lengths of an n-sided polygon.

Step 1: Start. Step 2: Enter the number of sides of the desired polygon. Step 3: Read the value n defining it as k which is of integer data type.

The above procedure can be explained below : For example, 

Consider a 5-sided polygon(pentagon).

Step 5: Define integer data type variables, i, j, t, sum.

Let the four natural numbers be 1, 7, 5, 8.

Step 6: Initialize t as (n+1) and sum as zero.

The side lengths of the polygon are 137, 14, 10, 16, 139.

Step 4: If k is greater than 2, go to step5, else, go to step15.

Step 7: Define arrays arr1[] and arr2[] with size n and t respectively.

The side lengths mentioned above satisfies Pythagoras theorem.

Step 8: Enter any n natural numbers. Step 9: Read those values using a for loop.

© 2017, IRJET

|

Impact Factor value: 5.181

We can represent this result in outputs.

|

ISO 9001:2008 Certified Journal

|

Page 459


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.