You are on page 1of 1

ES 112: Computing

Lab Assignment - 4
19 September 2019

1. Write a program that takes a binary string as input from the user and
converts it to decimal. For example:
INPUT: 100
OUTPUT: 4
2. Write a program that takes an integer n as input from the user and com-
putes the sum 12 + 23 + 34 + . . . + n+1
n
. For example:
INPUT: 5
OUTPUT: 3.55
3. Write programs to print the following pyramid patterns using loops.

4. Write a program that takes an integer n as input from the user and counts
the number of trailing zeroes in n!.
INPUT: 5
OUTPUT: 1 [5! = 120]
5. Write a program that takes an integer n as input from the user and
computes the number of trailing zeros in the result of the expression:
11 ∗ 22 ∗ 33 ∗ 44 ∗ . . . ∗ nn .
INPUT: 5
OUTPUT: 5 [11 ∗ 22 ∗ 33 ∗ 44 ∗ 55 = 86400000]

You might also like