REC02_Problems

# REC02_Problems - 1 14:440:127– Introduction to Computers...

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
This is the end of the preview. Sign up to access the rest of the 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. Euler’s number, e , is a mathematical constant with the value 2.71828 . Write a program that defines Euler’s 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 Euler’s number. The main function should call printE , which is a function that will print the variable containing Euler’s 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 doesn’t then...
View Full Document

## This note was uploaded on 02/20/2011 for the course ENGR 127 taught by Professor Hunter,eleswarapu,cortez during the Spring '11 term at Rutgers.

### Page1 / 3

REC02_Problems - 1 14:440:127– Introduction to Computers...

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

View Full Document
Ask a homework question - tutors are online