CSCE150 Fortran Lab 6 exam1 by hbf25307

VIEWS: 19 PAGES: 4

									  CSCE150
Fortran Lab 6
   exam1



                1
        Question (40 points)
  Write a Fortran program to determine
  whether a year (four digits, for example
  1999) is a leap year or not.
• the year is inputted by the user
• check whether this year is a leap year or not,
  and print “this is a leap year” or “this is not a
  leap year” to the user
• the program continuously accepts user inputs
  until “0” is inputted to terminal the test (the
  user should be able to test more than one
  year without run the program again)

                                                 2
               requirements
• Show me your comments (5 points)
• Show me how to compile and run your program (5
  points)
• Show me your test cases (5 points for each case)
  1: 1600 => this is a leap year
  2: 2008 => this is a leap year
  3: 1900 => this is not a leap year
  4: 1993 => this is not a leap year
• 5 points for an honest effort to code
• 5 points for compiling successfully

• 10 bonus points: finish within 30 mins (must compile
  successfully)
• 5 bonus points: finish within 50 mins (must compile
  successfully)
                                                     3
                      hints
• Leap year rules:
   if a year is divisible by 400
  or
   if a year is not divisible by 100, but divisible by 4
  http://en.wikipedia.org/wiki/Leap_year


• Intrinsic function: MOD
   example: MOD(year,400)==0
   page 735 of old textbook, page 886 of new
    textbook


                                                      4

								
To top