Docstoc

Handout1 (DOC)

Document Sample
Handout1 (DOC) Powered By Docstoc
					                  Homework 1
       Introduction to Programming in C
           Deadline is 28 March 2011

Exercise 1
Fill the empty fields in the following table:
          Binary                        Decimal                    Hexadecimal
      10101111                             175                             AF
  101110110011
                                                                        F3AD
                                         56918

Exercise 2
1) Develop the Pseudocode for the following Flow Chart:

                                                              START
                                                       read y from user input
                                                True
                       set y to 20                             y > 20
                                                                   False
                                                True
                       set y to 10                             y > 10
                                                                   False
                                                True
                        set y to 0                             y>0
                                                                   False
                                                            set y to 30

                                                         print y on output

                                                                END

2) What are the outputs of the Pseudocode for the following user inputs?
      i) 100        ii) 13        iii) 9       iv) 0



Homework 1 / Introduction to Programming in C                                   Page 1
Exercise 3
1) Develop the Pseudocode for the following Flow Chart

                                           START

                                          set x to 3

                                          set y to 2

                            False
                 END                         x>0
                                          True
                                         set x to x - 1

                                             y>0
                                                            False
                                         True
                                         set y to y - y

                                      print x on output

                                      print y on output

2) What is the output of the Pseudocode?

Tip: loop inside a loop (nested loops)

Exercise 4
1) Create a flowchart that reads a “watt-input”(number) from users input and prints
the brightness for that input. Take the following table as foundation for the brightness
calculation:

      Watts    Brightness (in Lumens)
       15                125
       40                500
       60                880
       75               1000
      100               1675

2) Develop Pseudo Code for the flowchart created in step 1.

Tip: Have a look at Exercise 1.




Homework 1 / Introduction to Programming in C                                   Page 2

				
DOCUMENT INFO