You are on page 1of 1

Introduction to Programming

If Else

Practice 1
Average Calculator Write a program that calculates the average of 4 grades of a student. If the average is above 70, display the grade with a Passing Message. If it is below 70, display failing. Special Average Calculator A teacher is calculating the average of a student. Along the year, there were 3 quizzes and 2 tests. The average is calculated by adding the 2 tests and the heights 2 quizzes, and than dividing by 4. If the final grade is above 70, we display the result and quit. If the final grade is below 70, than we recalculate the average by adding the 2 tests and the 3 quizzes, and than dividing by 4. Finally we display the result. Magic Number Write a program that generates a number, and than asks the user to guess the number. If he did, a success message appears. If he didnt, a message appears that tell us if the number is lower or higher than the magic number. Unit Transformer Write a program that can transform from centimeters to inches to foot as follows: At the beginning the program asks about the format of data you will enter (cm, in, or f). After that it asks you to what formats you want the program to transform the number you entered. Finally it displays the results. Note: 1 in = 2.54 cm 1 f = 30.48 cm Temperature Transformer Write a program that reads from you a temperature in either Degrees, or Kelvin, or Fahrenheit, and transforms the number to the 2 other types, displaying messages on whether the entered temperature is: very cold, cold, warm, hot, or very hot. Note: C/100 = (F 32)/180 = K/80 Number Guessing The computer will ask you to choose a number (without telling him the number), then it will guess the number you choose after asking you the following questions: - Choose a number - Add to it its value (double it) - Subtract from it 3 - Add to it 10 - Multiply the result by 2 - Add to it 1 - The number you have chosen is: ## Enhanced Magic Number Enhance the Magic Number program by telling us if we missed the number the following: Very Near, Near, Far, Very Far.

LIU University

Ahmad Ahdab

You might also like