BSC 0115-Intro. To Programming
Functions-Exercise
1. Which of the following is a valid function prototype for a C program that receives two integer
values and returns an integer number?
a. void fungsi (int, int);
b. int fungsi (int, int);
c. int fungsi (v

BSC0115INTRODUCTIONTOPROGRAMMING
LABEXERCISE
1. Write a while loop that will produce each of the following sequences:
a. 6, 8, 10, 12, , 66
b. The sum of the numbers between 1 and 15 inclusive.
c. The sum of the odd numbers between 1 and 45 inclusive.
2.

Function calls: Pass-by-value and Pass-by-reference
Whenever a calling function passes variables as arguments to functions, the values of the variables
are copied to the corresponding parameters. Even if the copies are modified locally in the sub
function

BSC0115INTRODUCTIONTOPROGRAMMING
ControlStructure(Selection)Exercise
Programming
1. Implement the following decision table using a nested if statement. Assume that the grade
point average is within the range 0.0 through 4.0.
Grade Point Average
0.0 0.99
1

BSC 0115 Introduction to Programming
Assignment 4
Name:
Total Points: (20m)
Matric No:
Section No:
1. Write a program that initializes an array (5 elements) of integers range between 1
and 999 randomly. The program prompts a user to enter a target value,

BSC0115INTRODUCTIONTOPROGRAMMING
Assignment2
A computer manufacturing company has the following fixed monthly compensation
policy to their salespersons:
Minimum base salary
Bonus for every computer sold
Commission on the total monthly sales
:
:
:
1500.00

BSC0115INTRODUCTIONTOPROGRAMMING
Assignment3
A recipe for making enough watermelon squash for four people requires the following
ingredients:
2 watermelon squashes
2 teaspoons of lemon juice
cup of raisins
1 cups of applesauce
cup of brown sugar
3 table

Base Conversion
Numbering System
Base Conversion
Base Conversion
In daily life, we use decimal (base 10)
number system
Computer can only read in 0 and 1
Number system being used inside a
computer is binary (base 2)
Octal (base 8) and hexadecimal (base 16)

Chapter 2:
Getting Started in
C Programming
Introduction to C Programming
C provides a comprehensive set of functions
Stored in a set of files known as the standard
library
The standard library consists of 15 header files
2
A First Book of
Introduction

Chapter 3
Processing and Interactive Input
Assignment
The general syntax for an assignment statement is
variable = operand;
The operand to the right of the assignment operator (=)
can be a constant, a variable, or an expression
The equal sign in C does

Chapter 4
Selection
Selection
Introduction
Flow of control refers to the order in which a
programs statements are executed
Any algorithm can be built using combinations of four
standardized flow of control structures:
Normal flow of control for all pro