practice for programmers
Logged in as Anonymous Student
254275 OOP - Loops and conditionals
A. Your age on Venus
Venus takes 224.70 Earth days to complete one orbit around the Sun (compared to Earth which takes 365.25 days). The program should input your age on Earth (integer) and output your age on Venus to 2 decimal places.
B. Planet names
Write a program that takes a planet name and outputs information about that planet. The program should accept input in any case (e.g. “Mars” == “mars” == “MARS”).
C. Multiples of seven
Write a program that prints out multiples of 7. The number of multiples to print out is the input to the program.
Write a program that inputs 4 numbers and returns the smallest.
E. Sum to one
Write a program that inputs a number x and generates the sum of x + (x-1) + … + 1. The number x is greater than zero.
F. Drawing rectangles
Write a program that inputs the width and height of a rectangle and then draws it using Xs.
G. Drawing diagonal lines
Write a program that inputs a length and then draws a straight line using backslash
of that length.
H. Word count the sequel
Write a program that reads in many lines of text and counts the number of words and punctuation marks (including: ,.?!).