html>C-ohjelmointi, laskuharj. 1

C-programming Fall 1999

Problems for Exercise 1 (20.-24.9.1999)

Write your C-programs from the very beginning with a computer. Points will be given only for solutions proven by a computer. Make sure of the correct functioning by compiling your program, correcting possible errors and by running program, if necessary using different test inputs. Avoid using, in your solutions, such features that have not been explained in the course.

1.Write a program that prints the 10x10 multiply matrix. Format the output such that all columns are equally wide.

2. Write a program that prints out the figure below.


          \ | | /
          (     )
          ( " " )
          (  *  )
          (_ ~ _)  
            VVV
            

3. Write a program that changes the amount of marks (1-100 mk) to euros. The program prints on screen a table, where each row gives first the amount in marks and then its value in euros. One euro is 5.94573 Finnish marks.

4. Write a program that deletes extra blancos from the given text so that the characters in each row are separated at most by one blanco and no line starts with a blanco. The text is given by keyboard and printed on screen.

5. Write a program that reads from the input stream characters until a blanco and prints out the characters in reverse order. For example the program reads characters C-programming and prints out gnimmargorp-C.

6. Write a program that deletes all comments from a C-program. Remember to handle also string and character constants. For example /* */ is a comment but "/* */" is a string constant.