File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ ###########################################################################
2+
3+ # Question - Arithmetic Progression Generator
4+
5+ # # Develop a program that:
6+ # 1- read the first term and the common difference of a arithmetic progression
7+ # 2- show the first 10 terms of this progression
8+ # 3- ask to user if he wants show some more terms
9+ # 4- finish the program when user says he wants to show 0 terms
10+
11+ ###########################################################################
12+
13+ print ("Arithmetic Progression Generator" )
14+ print ("-=" * 50 )
15+ first_term = int (input ("First term: " ))
16+ common_difference = int (input ("Common difference: " ))
17+ term = first_term
18+ cont = 1
19+ more = 10
20+ total = 0
21+ while more != 0 :
22+ total += more
23+ while cont <= total :
24+ print (f"{ term } " , end = " --> " )
25+ term += common_difference
26+ cont += 1
27+
28+ print ("PAUSE.\n " )
29+
30+ more = int (input ("How many terms you want to show more? " ))
31+ print (f"\n \n Arithmetic Progression was finished with { total } terms shown.\n \n " )
You can’t perform that action at this time.
0 commit comments