Results 1 to 5 of 5

Thread: size change in C

  1. #1
    Junior Member
    Join Date
    Jul 2002
    Location
    India
    Posts
    9

    size change in C

    Hi all,

    I found this question in Practical C programming."Write a program to print "Hello" in big block letters; each letter should have a hight of seven character and width of 5 character?"
    How to change the size of the character in C?

    And what does this mean?. A leap year is any year divisible by 4 unless the year is divisible by 100 but not 400.

    I got realy comfused with that.

    thank you all.

  2. #2
    Senior Member nihil's Avatar
    Join Date
    Jul 2003
    Location
    United Kingdom: Bridlington
    Posts
    17,188
    Hi,

    I will leave the first question to the experts.


    "Leap year" This happens every 4 years because a "year" is actually 365.25 days, not 365.00.

    It is an arbitrary adjustment, like the one where you have to add one second every 10000 years I bet you never wondered why atomic clocks are "accurate to 1 second in 10000 years"?

    What you have been given, is the algorithm to calculate "leap years" If you can divide by 4 it is a leap year. However, millenium years can also be leap years (but might not be) so 2000 is divisible by 4 (500x), it is divisible by 100 (200x) and by 400 (5x). The year 2000 was a leap year.

    The year 3000 is not divisible by 400, so is not a leap year. If you have any problems with this, please come and complain to me then, and I will buy you a beer

    The statement you were given is INCORRECT (assuming you copied it correctly) as the 100/400 test only applies to century/millenium years (last two digits = 00)

    Pseudocode:

    IF last 2 digits = "00"
    THEN run 100/400 test
    ELSE ........(buy nihil a beer)

    or something like that?

    Don't be afraid to "question the question"............I once saw an examination question for an English Professional Institute which, if you did what they (literally) asked would have got you 7-14 years under our Corporate Law/Fraud legislation

    Hope this helps, have a good weekend.

  3. #3
    Junior Member
    Join Date
    Jul 2002
    Location
    India
    Posts
    9
    thank you nihil. actually i found the question in the pratical c programming book.

  4. #4
    Senior Member nihil's Avatar
    Join Date
    Jul 2003
    Location
    United Kingdom: Bridlington
    Posts
    17,188
    Hi

    I think your book has it slightly wrong on the Leap Year algorithm...........the 100/400 test should only be applied to century years (last 2 digits =00). For example, 2004 is a leap year but would fail the 100/400 test.


    Cheers

  5. #5
    Well there are good tutorials in our tutorial forum here, just look in the index (by negative) and u will easity find the tutorials about c (under programming).

    The FACT that people ignore FACTS
    doesnt mean that FACTS are not FACTS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •