{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

exerciseJan18

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

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

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 : if-else & loops ]

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

View Full Document
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 : if-else & loops ]
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

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

View Full Document
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

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online