exerciseJan18

exerciseJan18 - find x . Once x has been correctly guessed,...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP202 Instructor: Ladan Mahabadi January 18, 2008 1. Guassian Summation: Write a program that receives an integer n from the user and adds 1 through n and displays the result. [two methods ]
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2. Divisors: Write a program that receives an integer and prints out all divisors of that integer. For instance, if the user enters 6, your program should display: 2, 3, 6. [two methods ]
Background image of page 2
3. Guess the Number! Write a program that randomly generates an integer x between 1 and 20 . Then ask the user to guess this value, receive his input, compare it with x and display: greater, smaller or equal. The purpose of the game is to count how many iterations the user will take to
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: find x . Once x has been correctly guessed, display the number of iterations. 4. Maclaurin Series: http://mathworld.wolfram.com/MaclaurinSeries.html Maclaurin series are a type of series expansion in which all terms are nonnegative integer powers of the variable. The Maclaurin series for Write a program that using the above series computes e. Your program should run for 10 iterations and then it should prompt the user if they want to continue or not. If the user chooses to continue, ask for how many more iterations and repeat this process until the user chooses to quit....
View Full Document

This note was uploaded on 04/14/2008 for the course COMP 202 taught by Professor Verbrugge during the Winter '07 term at McGill.

Page1 / 4

exerciseJan18 - find x . Once x has been correctly guessed,...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online