Hello everyone, this is Tanmay from Tanmay’s Corner. Today I wrote a program in python to calculate the sum of interior angle and each angle of a polygon from the number of its sides. User have to input the number of sides of the polygon and python would give the sum of interior angle and each angle of that regular polygon as output. It is very easy to write a program in python. I used the basic python functions like print, input, integer, string , etc to write the code. I tried writing the program in a very simple and easy manner. I used replit for this , It is a free online software to write program in any language like Java , JavaScript, C++, Python , etc. This software can be used on any low powered device also. Since I am using replit there is the difference of time.
This is the link for the code:
This is my replit account: https://replit.com/@TanmayGupta3
Please share your results on replit or in the comment box of youtube. Thanks for watching this video.
The code:
n = int(input(‘Enter the number of sides: ‘))
sa = (n-2)*180
ea = sa/n
print(‘The sum of interior angle is ‘, sa)
print(‘Each angle of the reguglar polygon with side ‘,n, ‘is ‘, ea)
The result:
Enter the number of sides: 3
The sum of interior angle is 180
Each angle of the reguglar polygon with side 3 is 60.0
#trycoding #coding #phython #programmer #code #learnpython #trending #yt #shorts #ytshorts #python #tutorial #pythonic #trending #code #pythonlanguage #yt #trending #trycoding #yt #coding #phython #code #learnpython
コメントを書く