CS 1620 Assignment #3 Spring 2001

How to handin.
Due: Thur Feb 8, 2001 @ midnight

Marks will be awarded for comments, style, readability, compiling and working correctly.
  1. Write a program that performs the following:

    Here is a sample of an input/output

     Enter your floating number: 4517.891
     The rightmost digit of the integral part is: 7      
     The second rightmost digit of the integral part is: 1      
    
    Note: Use the following input formats to test your program. xx.ff, xxx.fff, xxxx.ffff, xxxxx.fffff, where x and f are any digit.

  2. Write a program that asks the user to enter a temperature reading in Celsius and then prints the equivalent Fahrenheit value. Be sure to include at least one negative number in your test cases. Both Celsius and Fahrenheit must be declared as float. Use the following formula:
      F = 32 + (C × 180.0 / 100.0) 

    Here is a sample of an input/output

     Enter Temperature in Celsius: 37.0 
     Temperature in Fahrenheit is: 98.6 
    
  3. Assuming that c is declared as int. Write a program that outputs both c and its ASCII equivalent. Enclose the ASCII equivalent in single quotes (').

    Here is a sample of input/output

     Enter  next input: 65 
     The  ascii of 'A' is 65
    
     Enter  next input: 56 
     The  ascii of '8' is 56
    
     ...
    
    Run your program with the following data: 65, 90, 97, 122, 48, 57, 7, 38, 60,
    10, 13, 9, 11, 32, 27. 
    
  4. Write an interactive program that converts second to hours, minutes, and seconds. For an input of 7903 seconds, the output should be 7903 sec. = 2 hr. 11 min. 43 sec.

Assignment List | Prev | Next | Computer Science 1620
Department of Mathematics & Computer Science
University of Lethbridge Home Page