Computer Science
Write the program with maximum three lines of code and that assigns first 5 multiples of a number to 5 variables and then print them.
Python
Python Funda
94 Likes
Answer
a = int(input("Enter a number: "))
b, c, d, e = a * 2, a * 3, a * 4, a * 5
print(a, b, c, d, e)
Output
Enter a number: 2
2 4 6 8 10
Answered By
50 Likes
Related Questions
Write a program that generates the following output :
5
10
9
Assign value 5 to a variable using assignment operator (=) Multiply it with 2 to generate 10 and subtract 1 to generate 9.Write a Python program that accepts radius of a circle and prints its area.
Modify above program so as to print output as 5@10@9.
Write Python program that accepts marks in 5 subjects and outputs average marks.