CSCI 151 Introduction to Computer Science -

CSCI 151 Fall 2009 Assignment 1

The due date is Monday, September 28, 2009. The printout of the programs should be submitted in class during the lecture time, and the e-mail with the programs should be received by 3:50 pm on Monday, September 28, 2009

Please read the instructions on how to compile, run and submit outputs for your C program

Important note: Please, do your own work. Programs which are written in groups are easily identified and will receive grades of 0 for all participants.

Important: Each program has to include the detailed comments. Follow the Lecture examples.

Important: You have to use UNIX/LINUX in this course in ALL home and lab assignments.

Skill set for this assignment:

  • Understand and implement the Program Development Cycle
  • Use integer type of variables and assignment statements
  • Use basic arithmetic operations
  • Use printf and scanf functions
  • Printing strings
  • Save, run and submit programs

Problem 1 (25 points): Write a C program that prints the following three lines of text:

    Hello!
    Welcome to my class!
    You will learn C programming language!

Problem 2 (25 points):
Write a C program that prints a square, triangle and a diamond as shown:

****
****
****


*
**
***
****
*****


     *
   *   *
*         *
   *    *
     *

Problem 3 (25 points):
Write a C program that prompts the user to enter one integer number. The program obtains the number from the user and then checks if the input number is divisible by 3 and prints an appropriate message. For example if the input is 12, the output should be: 12 is divisible by 3, and if the input is 85, the output should be: 85 is not divisible by 3.

Problem 4 (25 points):
Write a C program that prompts the user to enter six integer numbers. The program obtains the numbers from the user, then finds and prints the sum and the product of the input numbers.

GOOD LUCK!