This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 1 14:440:127 Introduction to Computers for Engineers Recitation 02 Problems Rutgers University, Spring 2011 Instructor - Brenda V. Cortez 1. Eulers number, e , is a mathematical constant with the value 2.71828 . Write a program that defines Eulers number as a local variable and print it to the screen. 2. Now, write a program containing two functions, main and printE and a static variable containing Eulers number. The main function should call printE , which is a function that will print the variable containing Eulers number. 3. Develop a program that has a function that prints each letter in your name. Your main function should make the calls to each function, such that your name is printed in a single like, i.e. Brenda . Hint: If your name is Steve, you will have 5 functions, each printing a single character of your name. Also remember that strings are enclosed in double quotes, but characters are enclosed in single quotes. 4. Write a program containing a function that asks the user to enter a radius , calculates the area of a circle, and prints the answer to the user. 5. Write a program using an if/else statement that prompts the user for a number of type int . If the number entered is greater than zero, send a message to the user saying: You entered a number greater than zero.. Otherwise, if the number is not greater than zero, then send a message to the user saying: You entered a number that is not greater than zero. 6. Create a program that prompts the user to enter a letter. Use an if/else statement to check if the letter being entered matches one of the letters in your name. If it does, send a message to the user saying their character matches whatever letter in your name, but if it doesnt then...
View Full Document
- Spring '11