triangularNumber = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8;
print("The eighth triangular number is {0}".format(triangularNumber))
triangularNumber=0
for i in range (201):
triangularNumber=triangularNumber+i
print("The 200th triangular number is {0}".format(triangularNumber))
print("TABLE OF TRIANGULAR NUMBERS\n\n")
print(" n Sum from 1 to n\n")
print("--- -----------------\n")
triangularNumber=0
for i in range (1,11):
triangularNumber=triangularNumber+i
print(" {0} {1}\n".format(i,triangularNumber))
triangularNumber=0
number=10 #number=input("What triangular number do you want?")
for n in range (1,(number+1)):
triangularNumber+=n
print("triangular number {0} is {1}".format(number,triangularNumber))
for counter in range(1,6): #Outer Loop
number=12 #input("what triangular number do you want? ")
triangularNumber=0 #Variable Decaration
for n in range (1,(number+1)): #Inner Loop
triangularNumber+=n
#Result
print("Triangular Number {0} is {1}".format(number,triangularNumber))
count=1
while (count<=5):
print("{0}\n".format(count)) #Result
count+=1
print("Please type in two nonnegative integers.")
u=8 #u=input()
v=14 #v=input()
while(v!=0):
temp=u%v
u=v
v=temp
print("Their greatest common divisor is {0}\n".format(u))
import sys
number=113 #number=input("Enter your number.\n")
while(number!=0):
right_digit=number%10
sys.stdout.write("{0}".format(right_digit))
number=number/10
print("\n")
import sys
number=428 #number=input("Enter your number:\n")
while True: #Enter loop instantly for the first time
right_digit=number%10
sys.stdout.write("{0}".format(right_digit))
number=number/10
if(number == 0): #Check for exit condition
break
print("\n")