LAB 2.1 INTRODUCTION TO C PROGRAMMING

Size: px
Start display at page:

Download "LAB 2.1 INTRODUCTION TO C PROGRAMMING"

Transcription

1 LAB 2.1 INTRODUCTION TO C PROGRAMMING School of Computer and Communication Engineering Universiti Malaysia Perlis 1

2 1. OBJECTIVES: 1.1 To be able to apply basic rules and structures of C in writing a simple program. 1.2 To be able to use printf and scanf functions to display output and read input in a program. 1.3 To become familiar with fundamental data types. 1.4 To be able to name, declare, assign and print values of variables used in program. 2. TASKS: 2.1 What data types would you use to hold the following data and write C statements to declare them all. a. customer initial b. customer name c. your house number d. price Data type: e. car registration f. time g. 6 digit number 2

3 2.2 Write a statement (or comment) to accomplish each of the following: a. State that a program will calculate the product of three integers. b. Define the variables x, y, z and result to be type int. c. Prompt the user to enter three integers. d. Read three integers from the keyboard and store them in the variables x, y and z. e. Compute the product of the three integers contained in variables x, y and z and assign the answer to the variable result. f. Print The product is followed by the value of the integer variable result. 2.3 Using the statements you wrote in Task 2.2, write a complete program that calculates the product of three integers. 3

4 2.4 Write a program that calculates marked area of the circle, given input from the user r1 and r2. r2 r1 4

5 2.5 Write a program to find the equivalent series and parallel resistance for 3 resistor values. Your program should scan the 3 resistor values and then compute the equivalent series and parallel resistance for all 3 resistors. For example, if the 3 resistor values are r1=100, r2=200 and r3=300 ohms, respectively, their equivalent series resistance is r1 + r2 + r3 = = 600 ohms and their equivalent parallel resistance = 1 / [1/r1 + 1/r2 + 1/r3] = 1/[ ] = ohms. 5

6 2.6 Write a program that inputs one five-digit number, separates the number into its individual digits and prints separated from one another by three spaces each.[hint : Use combinations of integer division and the remainder operation.] For example, if the user types in 42139, the program should print: Sample Output: Enter value : Answer :

7 Additional Exercises: 2.7 Write a program to calculate the distance travel using the given formula below: S = vt + ½ at 2 In your program ask user to input through keyboard the value of: v = initial velocity a = acceleration t = time of travel 7

8 2.8 Write a program to take a depth (in kilometers) inside the earth as input data; compute and print the temperature at this depth in degrees Celsius and degrees Fahrenheit. Data Requirements Problem Input double ddepth Problem Outputs double ccelcius double dfahr /*depth in km*/ /*temperature in degrees Cescius*/ /*temperature in degrees Fahrenheit*/ Relevant Formulas Celcius = 10 (depth) + 20 /*Celsius temperature at depth in km*/ Fahrenheit = 1.8 (Celsius) + 32; 8

Lab Session # 1 Introduction to C Language. ALQUDS University Department of Computer Engineering

Lab Session # 1 Introduction to C Language. ALQUDS University Department of Computer Engineering 2013/2014 Programming Fundamentals for Engineers Lab Lab Session # 1 Introduction to C Language ALQUDS University Department of Computer Engineering Objective: Our objective for today s lab session is

More information

Faculty of Engineering Computer Engineering Department Islamic University of Gaza C++ Programming Language Lab # 6 Functions

Faculty of Engineering Computer Engineering Department Islamic University of Gaza C++ Programming Language Lab # 6 Functions Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2013 C++ Programming Language Lab # 6 Functions C++ Programming Language Lab # 6 Functions Objective: To be familiar with

More information

Lab ACN : C++ Programming Exercises

Lab ACN : C++ Programming Exercises Lab ACN : C++ Programming Exercises ------------------------------------------------------------------------------------------------------------------- Exercise 1 Write a temperature conversion program

More information

Solutions: Program 1: Program 2: //To calculate the Gross salary of an Employee

Solutions: Program 1: Program 2: //To calculate the Gross salary of an Employee Lab 2: Introduction to Computer Programming (ICP) (3:00pm to 4:30pm Computer Lab 3) Rab Nawaz Jadoon (Assistant Professor) Department of Computer Science CIIT, Abbottabad. rabnawaz@ciit.net.pk Dated: 05-09-2013

More information

1. Look carefully at the program shown below and answer the questions that follow.

1. Look carefully at the program shown below and answer the questions that follow. 1. Look carefully at the program shown below and answer the questions that follow. a. What is the name of the class of this program? BillClass b. Identify one variable that holds a String. item c. What

More information

Functions. Lab 4. Introduction: A function : is a collection of statements that are grouped together to perform an operation.

Functions. Lab 4. Introduction: A function : is a collection of statements that are grouped together to perform an operation. Lab 4 Functions Introduction: A function : is a collection of statements that are grouped together to perform an operation. The following is its format: type name ( parameter1, parameter2,...) { statements

More information

Fundamentals of Programming Data Types & Methods

Fundamentals of Programming Data Types & Methods Fundamentals of Programming Data Types & Methods By Budditha Hettige Overview Summary (Previous Lesson) Java Data types Default values Variables Input data from keyboard Display results Methods Operators

More information

Identify skills and personality traits of successful problem solving. Apply standard problem-solving techniques to aid in problem solving.

Identify skills and personality traits of successful problem solving. Apply standard problem-solving techniques to aid in problem solving. Identify skills and personality traits of successful problem solving. Apply standard problem-solving techniques to aid in problem solving. Apply problem-solving techniques to programming activities. Generate

More information

MA 511: Computer Programming Lecture 2: Partha Sarathi Mandal

MA 511: Computer Programming Lecture 2: Partha Sarathi Mandal MA 511: Computer Programming Lecture 2: http://www.iitg.ernet.in/psm/indexing_ma511/y10/index.html Partha Sarathi Mandal psm@iitg.ernet.ac.in Dept. of Mathematics, IIT Guwahati Semester 1, 2010-11 Largest

More information

SHARDA UNIVERSITY SCHOOL OF ENGINEERING & TECHNOLOGY Mid Term Examination, (Odd Term, ) SOLUTION

SHARDA UNIVERSITY SCHOOL OF ENGINEERING & TECHNOLOGY Mid Term Examination, (Odd Term, ) SOLUTION SHARDA UNIVERSITY SCHOOL OF ENGINEERING & TECHNOLOGY Mid Term Examination, (Odd Term, 2016-17) SOLUTION Program: B. Tech. Branch: All Term:I Subject: Logic Building and Problem Solving Using C Paper Code:

More information

Data Types & Variables

Data Types & Variables Fundamentals of Programming Data Types & Variables Budditha Hettige Exercise 3.1 Write a C++ program to display the following output. Exercise 3.2 Write a C++ program to calculate and display total amount

More information

Computer Programming, I. Laboratory Manual. Experiment #2. Elementary Programming

Computer Programming, I. Laboratory Manual. Experiment #2. Elementary Programming Think Twice Code Once The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2005 Khaleel I. Shaheen Computer Programming, I Laboratory Manual Experiment #2

More information

IT 1033: Fundamentals of Programming Data types & variables

IT 1033: Fundamentals of Programming Data types & variables IT 1033: Fundamentals of Programming Data types & variables Budditha Hettige Department of Computer Science Exercise 3.1 Write a C++ program to display the following output. Exercise 3.2 Write a C++ program

More information

Stratford upon Avon School Mathematics Homework Booklet

Stratford upon Avon School Mathematics Homework Booklet Stratford upon Avon School Mathematics Homework Booklet Year: 7 Scheme: 1 Term: 1 Name: Show your working out here Homework Sheet 1 1: Write 7:43 pm using the 24 hour clock 11: Find the area of this shape.

More information

Week 3: Objects, Input and Processing

Week 3: Objects, Input and Processing CS 170 Java Programming 1 Week 3: Objects, Input and Processing Learning to Create Objects Learning to Accept Input Learning to Process Data What s the Plan? Topic I: Working with Java Objects Learning

More information

CPE 101, reusing/mod slides from a UW course (used by permission) Lecture 5: Input and Output (I/O)

CPE 101, reusing/mod slides from a UW course (used by permission) Lecture 5: Input and Output (I/O) CPE 101, reusing/mod slides from a UW course (used by permission) Lecture 5: Input and Output (I/O) Overview (5) Topics Output: printf Input: scanf Basic format codes More on initializing variables 2000

More information

LAB 5: REPETITION STRUCTURE(LOOP)

LAB 5: REPETITION STRUCTURE(LOOP) LAB 5: REPETITION STRUCTURE(LOOP) OBJECTIVES 1. To introduce two means of repetition/loop structures; counter-controlled and sentinelcontrolled. 2. To introduce the repetition structures; for, while, do-while

More information

LAB 2 INTRODUCTION TO PROGRAMMING

LAB 2 INTRODUCTION TO PROGRAMMING LAB 2 INTRODUCTION TO PROGRAMMING School of Computer and Communication Engineering Universiti Malaysia Perlis 1 OBJECTIVES 1. Clear understanding of sequential, selection and repetition structure to solve

More information

Full file at

Full file at 2 Introduction to C Programming Solutions What s in a name? That which we call a rose By any other name would smell as sweet. William Shakespeare When faced with a decision, I always ask, What would be

More information

LAB 5: REPETITION STRUCTURE(LOOP)

LAB 5: REPETITION STRUCTURE(LOOP) LAB 5: REPETITION STRUCTURE(LOOP) OBJECTIVES 1. To introduce two means of repetition/loop structures; counter-controlled and sentinelcontrolled. 2. To introduce the repetition structures; for, while, do-while

More information

Lab 2: Structured Program Development in C

Lab 2: Structured Program Development in C Lab 2: Structured Program Development in C (Part A: Your first C programs - integers, arithmetic, decision making, Part B: basic problem-solving techniques, formulating algorithms) Learning Objectives

More information

WARM UP LESSONS BARE BASICS

WARM UP LESSONS BARE BASICS WARM UP LESSONS BARE BASICS CONTENTS Common primitive data types for variables... 2 About standard input / output... 2 More on standard output in C standard... 3 Practice Exercise... 6 About Math Expressions

More information

! A program is a set of instructions that the. ! It must be translated. ! Variable: portion of memory that stores a value. char

! A program is a set of instructions that the. ! It must be translated. ! Variable: portion of memory that stores a value. char Week 1 Operators, Data Types & I/O Gaddis: Chapters 1, 2, 3 CS 5301 Fall 2016 Jill Seaman Programming A program is a set of instructions that the computer follows to perform a task It must be translated

More information

(b) Vsource R2 Vsource

(b) Vsource R2 Vsource Spring 2018 Programming Assignment #2: Basic /O and Operations Due Wednesday, 2/7/18 Friday, 2/9/18, 11:59:59 PM 1. ntroduction This assignment will give you some experience working with C input (using

More information

1. The programming language C is more than 30 years old. True or False? (Circle your choice.)

1. The programming language C is more than 30 years old. True or False? (Circle your choice.) Name: Section: Grade: Answer these questions while viewing the assigned videos. Not sure of an answer? Ask your instructor to explain at the beginning of the next class session. You can then fill in your

More information

Arrays and Strings. Arash Rafiey. September 12, 2017

Arrays and Strings. Arash Rafiey. September 12, 2017 September 12, 2017 Arrays Array is a collection of variables with the same data type. Arrays Array is a collection of variables with the same data type. Instead of declaring individual variables, such

More information

Introduction to Object Oriented Systems Development. Practical Session (Week 2)

Introduction to Object Oriented Systems Development. Practical Session (Week 2) This practical session consists of three parts. Practical Session (Week 2) Part 1 (Tutorial). Starting with NetBeans In this module, we will use NetBeans IDE (Integrated Development Environment) for Java

More information

Display Input and Output (I/O)

Display Input and Output (I/O) 2000 UW CSE CSE / ENGR 142 Programming I isplay Input and Output (I/O) -1 Writing Useful Programs It s hard to write useful programs using only variables and assignment statements Even our Fahrenheit to

More information

and function calls (including call-by-reference parameters and global variables), but no decision or repetition instructions.

and function calls (including call-by-reference parameters and global variables), but no decision or repetition instructions. 60-140-1 and 60-140-2 ASSIGNMENT #4 SOLUTION Handed Out:Thurs. Oct 22, 2015 for (60-140-01 and 60-140-02) Due: Thurs Oct 29, 2015 for (60-140-01 and 60-140-02) Total: 50 marks Objective of Assignment :

More information

A.P. Computer Science A Summer Packet

A.P. Computer Science A Summer Packet A.P. Computer Science A Summer Packet Name: Advisory Teacher: AP Computer Science A Summer 2017 Dear Student, Computer Science is a growing subject of study, and one that leads to many opportunities in

More information

LAB 6 FUNCTIONS I School of Computer and Communication Engineering

LAB 6 FUNCTIONS I School of Computer and Communication Engineering LAB 6 FUNCTIONS I School of Computer and Communication Engineering 1 Universiti Malaysia Perlis 1. OBJECTIVES: 1.1 To apply functions as building blocks of programs. 1.2 To write C programs using functions.

More information

ADD Identifier-1 TO Identifier-2 Literal-1. ADD Identifier-1. GIVING Identifier-2 Literal-1

ADD Identifier-1 TO Identifier-2 Literal-1. ADD Identifier-1. GIVING Identifier-2 Literal-1 The Basic Arithmetic Verbs All basic arithmetic operations of ADD, SUBTRACT, MULTIPLY, and DIVIDE require the fields operated on :- 1) Have numeric PICTURE clause 2) Actually have numeric data when the

More information

Introduction to Programming in Turing. Input, Output, and Variables

Introduction to Programming in Turing. Input, Output, and Variables Introduction to Programming in Turing Input, Output, and Variables The IPO Model The most basic model for a computer system is the Input-Processing-Output (IPO) Model. In order to interact with the computer

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #06 Loops: Operators

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #06 Loops: Operators Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #06 Loops: Operators We have seen comparison operators, like less then, equal to, less than or equal. to and

More information

LAB 1 Binary Numbers/ Introduction to C. Rajesh Rajamani. ME 4231 Department of Mechanical Engineering University Of Minnesota

LAB 1 Binary Numbers/ Introduction to C. Rajesh Rajamani. ME 4231 Department of Mechanical Engineering University Of Minnesota LAB 1 Binary Numbers/ Introduction to C Rajesh Rajamani ME 431 Department of Mechanical Engineering University Of Minnesota OVERVIEW What is feedback control? Binary and Hexadecimal Numbers Working with

More information

CSCI 111 Midterm 1, version A Exam Fall Solutions 09.00am 09.50am, Tuesday, October 13, 2015

CSCI 111 Midterm 1, version A Exam Fall Solutions 09.00am 09.50am, Tuesday, October 13, 2015 QUEENS COLLEGE Department of Computer Science CSCI 111 Midterm 1, version A Exam Fall 2015 10.13.15 Solutions 09.00am 09.50am, Tuesday, October 13, 2015 Problem 1 Write a complete C++ program that does

More information

Methods CSC 121 Fall 2014 Howard Rosenthal

Methods CSC 121 Fall 2014 Howard Rosenthal Methods CSC 121 Fall 2014 Howard Rosenthal Lesson Goals Understand what a method is in Java Understand Java s Math Class Learn the syntax of method construction Learn both void methods and methods that

More information

LAB 6 FUNCTION PART 1 School of Computer and Communication Engineering Universiti Malaysia Perlis

LAB 6 FUNCTION PART 1 School of Computer and Communication Engineering Universiti Malaysia Perlis Laboratory Module [Updated October 2017] LAB 6 FUNCTION PART 1 School of Computer and Communication Engineering Universiti Malaysia Perlis 1 OBJECTIVES 1. To differentiate between predefined function and

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #13. Loops: Do - While

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #13. Loops: Do - While Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #13 Loops: Do - While So far we have been using while loops in C, now C programming language also provides you

More information

COMP 202 Java in one week

COMP 202 Java in one week COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of

More information

Course Outline Introduction to C-Programming

Course Outline Introduction to C-Programming ECE3411 Fall 2015 Lecture 1a. Course Outline Introduction to C-Programming Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk,

More information

Intermediate Programming, Spring 2017*

Intermediate Programming, Spring 2017* 600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #28. Functions: Examples 2

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #28. Functions: Examples 2 Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #28 Functions: Examples 2 (Refer Slide Time: 00:14) With the concepts we have seen so far, let us design a sample

More information

3 The L oop Control Structure

3 The L oop Control Structure 3 The L oop Control Structure Loops The while Loop Tips and Traps More Operators The for Loop Nesting of Loops Multiple Initialisations in the for Loop The Odd Loop The break Statement The continue Statement

More information

Introduction to C++ (using Microsoft Visual C++)

Introduction to C++ (using Microsoft Visual C++) Introduction to C++ (using Microsoft Visual C++) By the end of this section, the students should be able to: Understand the basics of C++ programs and its development environment. Develop a simple C++

More information

The Hyderabad Public School, Begumpet, Hyderabad, A.P

The Hyderabad Public School, Begumpet, Hyderabad, A.P The Hyderabad Public School, Begumpet, Hyderabad, A.P. 500 016 2012-13 Department of Computer Science Class 8 Worksheet 3 1) How many times will the following statement execute? ( ) int a=5; while(a>6)

More information

Objectives. Data Types (continued) Data Types 4. การเข ยนโปรแกรมพ นฐาน ว ทยาการคอมพ วเตอร เบ องต น Fundamentals of Computer Science

Objectives. Data Types (continued) Data Types 4. การเข ยนโปรแกรมพ นฐาน ว ทยาการคอมพ วเตอร เบ องต น Fundamentals of Computer Science 204111 ว ทยาการคอมพ วเตอร เบ องต น Fundamentals of Computer Science ภาคการศ กษาท ภาคการศกษาท 1 ป ปการศกษา การศ กษา 2556 4. การเข ยนโปรแกรมพ นฐาน 4.2 ต วแปร น พจน และการก าหนดค า รวบรวมโดย อ. ดร. อาร ร

More information

Question 2. [2 points] Which of the following is a correct statement to obtain user input? (Assume that fleems is an int variable.

Question 2. [2 points] Which of the following is a correct statement to obtain user input? (Assume that fleems is an int variable. CS 101, Spring 2016 Feb 23rd Exam 1 Name: Question 1. [2 points] Write a statement(s) to declare a variable named num students that will be used to store the number of students and set the value of the

More information

ET156 Introduction to C Programming

ET156 Introduction to C Programming ET156 Introduction to C Programming Unit 1 INTRODUCTION TO C PROGRAMMING: THE C COMPILER, VARIABLES, MEMORY, INPUT, AND OUTPUT Instructor : Stan Kong Email : skong@itt tech.edutech.edu Figure 1.3 Components

More information

CSE / ENGR 142 Programming I

CSE / ENGR 142 Programming I CSE / ENGR 142 Programming I Variables, Values, and Types Chapter 2 Overview Chapter 2: Read Sections 2.1-2.6, 2.8. Long chapter, short snippets on many topics Later chapters fill in detail Specifically:

More information

A Simple & Economical Method For Reading A Thermistor With An EtherMeter.

A Simple & Economical Method For Reading A Thermistor With An EtherMeter. 24VDC COMMON 5VDC Application Note 011 Version 004 08 Nov 2010 A Simple & Economical Method For Reading A Thermistor With An EtherMeter. Along with its two meter inputs and three digital I/O channels,

More information

Problem 3: Theoretical Questions: Complete the midterm exam taken from a previous year attached at the end of the assignment.

Problem 3: Theoretical Questions: Complete the midterm exam taken from a previous year attached at the end of the assignment. CSE 2021: Computer Organization Assignment # 1: MIPS Programming Due Date: October 25, 2010 Please note that a short quiz based on Assignment 1 will be held in class on October 27, 2010 to assess your

More information

C-1. Overview. CSE 142 Computer Programming I. Review: Computer Organization. Review: Memory. Declaring Variables. Memory example

C-1. Overview. CSE 142 Computer Programming I. Review: Computer Organization. Review: Memory. Declaring Variables. Memory example CSE 142 Computer Programming I Variables Overview Concepts this lecture: Variables Declarations Identifiers and Reserved Words Types Expressions Assignment statement Variable initialization 2000 UW CSE

More information

CS16 Exam #1 7/17/ Minutes 100 Points total

CS16 Exam #1 7/17/ Minutes 100 Points total CS16 Exam #1 7/17/2012 75 Minutes 100 Points total Name: 1. (10 pts) Write the definition of a C function that takes two integers `a` and `b` as input parameters. The function returns an integer holding

More information

LOOPS. 1- Write a program that prompts user to enter an integer N and determines and prints the sum of cubes from 5 to N (i.e. sum of 5 3 to N 3 ).

LOOPS. 1- Write a program that prompts user to enter an integer N and determines and prints the sum of cubes from 5 to N (i.e. sum of 5 3 to N 3 ). LOOPS 1- Write a program that prompts user to enter an integer N and determines and prints the sum of cubes from 5 to N (i.e. sum of 5 3 to N 3 ). 2-Give the result of the following program: #include

More information

1.1 Introduction. 1.2 Model

1.1 Introduction. 1.2 Model 1 Change of Scales 1.1 Introduction Consider the concept of Temperature. It is used in heat transfer which seeks to understand energy transfer in material bodies as a result of temperature differences.

More information

Q1: Multiple choice / 20 Q2: C input/output; operators / 40 Q3: Conditional statements / 40 TOTAL SCORE / 100 EXTRA CREDIT / 10

Q1: Multiple choice / 20 Q2: C input/output; operators / 40 Q3: Conditional statements / 40 TOTAL SCORE / 100 EXTRA CREDIT / 10 16.216: ECE Application Programming Spring 2015 Exam 1 February 23, 2015 Name: ID #: For this exam, you may use only one 8.5 x 11 double-sided page of notes. All electronic devices (e.g., calculators,

More information

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved. C How to Program, 6/e 1992-2010 by Pearson Education, Inc. An important part of the solution to any problem is the presentation of the results. In this chapter, we discuss in depth the formatting features

More information

Fundamentals of Computer Science Laboratory 2 Sequential programs

Fundamentals of Computer Science Laboratory 2 Sequential programs Fundamentals of Computer Science 2010-2011 Laboratory 2 Sequential programs Objetivos: VB Controls: command button (cmd), form (frm, label (lbl), text box (txt) and picture box (pct) VB controls properties:

More information

Topic 2: C++ Programming fundamentals

Topic 2: C++ Programming fundamentals Topic 2: C++ Programming fundamentals Learning Outcomes Upon successful completion of this topic you will be able to: describe basic elements of C++ programming language compile a program identify and

More information

Copy: IF THE PROGRAM or OUTPUT is Copied, then both will have grade zero.

Copy: IF THE PROGRAM or OUTPUT is Copied, then both will have grade zero. THIS IS HOMEWORK FOR PART-1 OF C/C++ COURSE Instructor: Prof Yahia Halabi Submit: Before exam-1 period [one week from 24/02/2013] Groups: Allowed to work in groups, but at the end, everyone should submit

More information

C Programming for Electronic Engineers

C Programming for Electronic Engineers C Programming for Electronic Engineers Keith Jackson BSc CEng MIEE with acknowledgement to Gavin Eamshaw MEng School of Electronic, Communication and Electrical Engineering University of Plymouth MACMILLAN

More information

Assignment 2: Temperature Class

Assignment 2: Temperature Class Assigned: September 23, 2016 Due: October 03, 2016, 11:59:59pm Assignment 2: Temperature Class Purpose The purpose of this project is to provide you more practice with implementing classes. Here you will

More information

CMPS 10 Introduction to Computer Science Lecture Notes

CMPS 10 Introduction to Computer Science Lecture Notes CMPS Introduction to Computer Science Lecture Notes Binary Numbers Until now we have considered the Computing Agent that executes algorithms to be an abstract entity. Now we will be concerned with techniques

More information

C: How to Program. Week /Mar/05

C: How to Program. Week /Mar/05 1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers

More information

B. V. Patel Institute of Business Management, Computer & Information Technology, UTU 2013

B. V. Patel Institute of Business Management, Computer & Information Technology, UTU 2013 Information Technology, UTU 203 030000 Fundamentals of Programming Problems to be solved in laboratory Note: Journal should contain followings for all problems given below:. Problem Statement 2. Algorithm

More information

CS Spring 2018 Homework #5

CS Spring 2018 Homework #5 CS 1313 010 Spring 2018 Homework #5 Quiz to be held in lecture 9:30-9:45am Mon Feb 19 2018 1. HOW CAN YOU TELL that a declaration statement declares a named constant? 2. HOW CAN YOU TELL that a declaration

More information

INDEX. Sl. No. Programs Page No. Procedure 2. 1 To check whether person is eligible for vote or not. 2 To find the given number is even or odd 6-8

INDEX. Sl. No. Programs Page No. Procedure 2. 1 To check whether person is eligible for vote or not. 2 To find the given number is even or odd 6-8 INDEX Sl. No. Programs Page No. Procedure 2 1 To check whether person is eligible for vote or not 3-5 2 To find the given number is even or odd 6-8 3 To find the given year is leap year or not 9-11 4 To

More information

Tutorial 7. Number Colour Black Brown Red Orange Yellow Green Blue Violet Gray White

Tutorial 7. Number Colour Black Brown Red Orange Yellow Green Blue Violet Gray White Tutorial 7 Question 1. Write a C program which declares an array of 20 integers, and initialises them such that the first value is 1, the second 2, and so on, with the last value being 20. Use a loop to

More information

CC112 Structured Programming

CC112 Structured Programming Arab Academy for Science and Technology and Maritime Transport College of Engineering and Technology Computer Engineering Department CC112 Structured Programming Lecture 3 1 LECTURE 3 Input / output operations

More information

Introduction to FORTRAN

Introduction to FORTRAN Introduction to by Dr. Ibrahim A. Assakkaf Spring 2000 Department of Civil and Environmental Engineering University of Maryland Slide No. 1 Introduction = FORmula TRANslation Developed for the IBM 704

More information

download instant at

download instant at 2 Introduction to Java Applications: Solutions What s in a name? That which we call a rose By any other name would smell as sweet. William Shakespeare When faced with a decision, I always ask, What would

More information

CS 105 Lab As a review of what we did last week a. What are two ways in which the Python shell is useful to us?

CS 105 Lab As a review of what we did last week a. What are two ways in which the Python shell is useful to us? 1 CS 105 Lab 3 The purpose of this lab is to practice the techniques of making choices and looping. Before you begin, please be sure that you understand the following concepts that we went over in class:

More information

S8352: Java From the Very Beginning Part I - Exercises

S8352: Java From the Very Beginning Part I - Exercises S8352: Java From the Very Beginning Part I - Exercises Ex. 1 Hello World This lab uses the Eclipse development environment which provides all of the tools necessary to build, compile and run Java applications.

More information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information

การเขยนโปรแกรมพนฐาน ภาคการศ กษาท 1 ป การศ กษา การเข ยนโปรแกรมพ นฐาน ว ทยาการคอมพ วเตอร เบ องต วทยาการคอมพวเตอรเบองตน น

การเขยนโปรแกรมพนฐาน ภาคการศ กษาท 1 ป การศ กษา การเข ยนโปรแกรมพ นฐาน ว ทยาการคอมพ วเตอร เบ องต วทยาการคอมพวเตอรเบองตน น 204111 ว ทยาการคอมพ วเตอร เบ องต วทยาการคอมพวเตอรเบองตน น Fundamentals of Computer Science ภาคการศ กษาท 1 ป การศ กษา 2556 4. การเข ยนโปรแกรมพ นฐาน การเขยนโปรแกรมพนฐาน 4.2 ต วแปร น พจน และการก าหนดค า รวบรวมโดย

More information

Module Contact: Dr Pierre Chardaire, CMP Copyright of the University of East Anglia Version 1

Module Contact: Dr Pierre Chardaire, CMP Copyright of the University of East Anglia Version 1 UNIVERSITY OF EAST ANGLIA School of Computing Sciences Main Series UG Examination 2015/16 INTRODUCTORY PROGRAMMING CMP-0005B Time allowed: 2 hours. Answer BOTH questions from section A and ONE question

More information

Hands-on Lab 1: LabVIEW NI-DAQ Basics 1

Hands-on Lab 1: LabVIEW NI-DAQ Basics 1 Hands-on Lab 1: LabVIEW NI-DAQ Basics 1 This lab reviews LabVIEW concepts needed towards the course s final objective of position regulation using computer-controlled state feedback. Specific LabVIEW concepts

More information

download instant at Introduction to C++

download instant at  Introduction to C++ Introduction to C++ 2 Programming: Solutions What s in a name? that which we call a rose By any other name would smell as sweet. William Shakespeare When faced with a decision, I always ask, What would

More information

Chapter 2 - Introduction to C Programming

Chapter 2 - Introduction to C Programming Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic

More information

2. Numbers In, Numbers Out

2. Numbers In, Numbers Out COMP1917: Computing 1 2. Numbers In, Numbers Out Reading: Moffat, Chapter 2. COMP1917 15s2 2. Numbers In, Numbers Out 1 The Art of Programming Think about the problem Write down a proposed solution Break

More information

in normal arithmetic = == = == 5 7 x 2 = 24 7 * 2 == = 3 remainder 1 7 / 2 7 % 2

in normal arithmetic = == = == 5 7 x 2 = 24 7 * 2 == = 3 remainder 1 7 / 2 7 % 2 2 Arithmetic 2.1 The Natural Numbers We have all used natural counting numbers such as 1, 2 and 3 in simple arithmetic calculations. In C, the natural counting numbers between 0 and 65535 inclusive are

More information

CS 150 Lab 3 Arithmetic and the Debugger. Lab 3.0 We are going to begin using the Visual Studio 2017 debugger to aid with debugging programs.

CS 150 Lab 3 Arithmetic and the Debugger. Lab 3.0 We are going to begin using the Visual Studio 2017 debugger to aid with debugging programs. CS 150 Lab 3 Arithmetic and the Debugger The main objective of today s lab is to use some basic mathematics to solve a few real world problems. In doing so, you are to begin getting accustomed to using

More information

Variables, Data Types, and Arithmetic Expressions Learning Objectives:

Variables, Data Types, and Arithmetic Expressions Learning Objectives: Variables, Data Types, and Arithmetic Expressions Learning Objectives: Printing more than one variable in one printf() Printing formatting characters in printf Declaring and initializing variables A couple

More information

LAB 13 FILE PROCESSING

LAB 13 FILE PROCESSING LAB 13 FILE PROCESSING School of Computer and Communication Engineering Universiti Malaysia Perlis 1 1. OBJECTIVES: 1.1 To be able to create, read, write and update files. 1.2 To become familiar with sequential

More information

Chapter 2: Data and Expressions

Chapter 2: Data and Expressions Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University April 21, 2015 Chapter 2: Data and Expressions CS 121 1 / 53 Chapter 2 Part 1: Data Types

More information

CISC 110 Week 3. Expressions, Statements, Programming Style, and Test Review

CISC 110 Week 3. Expressions, Statements, Programming Style, and Test Review CISC 110 Week 3 Expressions, Statements, Programming Style, and Test Review Today Review last week Expressions/Statements Programming Style Reading/writing IO Test review! Trace Statements Purpose is to

More information

IS12 - Introduction to Programming. Data Types and Variables

IS12 - Introduction to Programming. Data Types and Variables IS12 - Introduction to Programming Lecture 9: Variables Peter Brusilovsky http://www2.sis.pitt.edu/~peterb/0012-072/ Data Types and Variables 1 Three things to do with a variable Declare a variable int

More information

Input/Output Week 5:Lesson 16.1

Input/Output Week 5:Lesson 16.1 Input/Output Week 5:Lesson 16.1 Commands (On-Line) scanf/printf Principles of Programming-I / 131101 Prepared by: Dr. Bahjat Qazzaz --------------------------------------------------------------------------------------------

More information

Boolean Expressions. So, for example, here are the results of several simple Boolean expressions:

Boolean Expressions. So, for example, here are the results of several simple Boolean expressions: Boolean Expressions Now we have the ability to read in some information, calculate some formulas and display the information to the user in a nice format. However, the real power of computer programs lies

More information

Lesson 02 Data Types and Statements. MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

Lesson 02 Data Types and Statements. MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Lesson 02 Data Types and Statements MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Topics Covered Statements Variables Constants Data Types

More information

Chapter 2: Overview of C. Problem Solving & Program Design in C

Chapter 2: Overview of C. Problem Solving & Program Design in C Chapter 2: Overview of C Problem Solving & Program Design in C Addison Wesley is an imprint of Why Learn C? Compact, fast, and powerful High-level Language Standard for program development (wide acceptance)

More information

LAB 13 FILE PROCESSING

LAB 13 FILE PROCESSING LAB 13 FILE PROCESSING School of Computer and Communication Engineering Universiti Malaysia Perlis 1 1. OBJECTIVES: 1.1 To be able to create, read, write and update files. 1.2 To become familiar with sequential

More information

Chapter 2: Data and Expressions

Chapter 2: Data and Expressions Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University January 15, 2015 Chapter 2: Data and Expressions CS 121 1 / 1 Chapter 2 Part 1: Data

More information

LAB: INTRODUCTION TO FUNCTIONS IN C++

LAB: INTRODUCTION TO FUNCTIONS IN C++ LAB: INTRODUCTION TO FUNCTIONS IN C++ MODULE 2 JEFFREY A. STONE and TRICIA K. CLARK COPYRIGHT 2014 VERSION 4.0 PALMS MODULE 2 LAB: FUNCTIONS IN C++ 2 Introduction This lab will provide students with an

More information

7.1 It is well known that the formula for converting a temperature in Celsius to Fahrenheit is. o F = 9 5 o C (7.10)

7.1 It is well known that the formula for converting a temperature in Celsius to Fahrenheit is. o F = 9 5 o C (7.10) 190 Engineering Software Development in Java 7.15 Exercises The problems in this section cover the basics, including use of keyboard input, looping and branching constructs, simple arrays, and generation

More information

PRIMITIVE VARIABLES. CS302 Introduction to Programming University of Wisconsin Madison Lecture 3. By Matthew Bernstein

PRIMITIVE VARIABLES. CS302 Introduction to Programming University of Wisconsin Madison Lecture 3. By Matthew Bernstein PRIMITIVE VARIABLES CS302 Introduction to Programming University of Wisconsin Madison Lecture 3 By Matthew Bernstein matthewb@cs.wisc.edu Variables A variable is a storage location in your computer Each

More information

Variable and Data Type I

Variable and Data Type I Islamic University Of Gaza Faculty of Engineering Computer Engineering Department Lab 2 Variable and Data Type I Eng. Ibraheem Lubbad September 24, 2016 Variable is reserved a location in memory to store

More information

Using Excel 2001 to Create a Data Table 11 of 29

Using Excel 2001 to Create a Data Table 11 of 29 Using Excel 2001 to Create a Data Table 11 of 29 3 Click on cells A8 and A9. Notice the calculator automatically adds the contents of the cells you click on. You can override the addition by choosing a

More information

Lab01: C++ Expressions ES036a: Programming Fundamentals Fall 2007

Lab01: C++ Expressions ES036a: Programming Fundamentals Fall 2007 Lab01: C++ Expressions ES036a: Programming undamentals all 2007 A. Rationale and Background Welcome to ES036b Lab01. In Lab00 we learned how to create a solution and then a project within this solution

More information