Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ProgressaoAritmetica.py
- #
- # Copyright 2021 Elizeu Barbosa Abreu <elizeubcorreios@gmail.com>
- #
- # This program is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- # MA 02110-1301, USA.
- #
- #
- termo = 0
- def pa():
- primeiro = int(input('Entre com o primeiro termo da PA: '))
- razao = int(input('Entre com a razão da PA: '))
- quantidade = int(input('Quantos termos da PA você quer exibir? '))
- ultimo = primeiro + quantidade * razao
- termoatual = primeiro
- for num in range(primeiro, ultimo, razao):
- termo += 1
- print('{}º termo = {}'.format(termo, termoatual))
- termoatual += razao
- pa()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement