100% found this document useful (1 vote)
16 views

Computer Programming - eBook PDF instant download

The document provides information on various computer programming eBooks available for download, including titles on Python, C, and MATLAB. It features a detailed introduction to computer programming, authored by E Balagurusamy, and outlines the structure and content of the book. Additionally, it includes a comprehensive syllabus and chapters covering fundamental programming concepts and languages.

Uploaded by

menorgrohsdp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
16 views

Computer Programming - eBook PDF instant download

The document provides information on various computer programming eBooks available for download, including titles on Python, C, and MATLAB. It features a detailed introduction to computer programming, authored by E Balagurusamy, and outlines the structure and content of the book. Additionally, it includes a comprehensive syllabus and chapters covering fundamental programming concepts and languages.

Uploaded by

menorgrohsdp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

Computer Programming - eBook PDF install

download

https://ebookluna.com/download/computer-programming-ebook-pdf/

Download more ebook from https://ebookluna.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Python Programming: An Introduction to Computer Science


3rd Edition by John Zelle (eBook PDF)

https://ebookluna.com/product/python-programming-an-introduction-to-
computer-science-3rd-edition-by-john-zelle-ebook-pdf/

ebookluna.com

(eBook PDF) Programming Language Pragmatics, 4th Edition

https://ebookluna.com/product/ebook-pdf-programming-language-
pragmatics-4th-edition/

ebookluna.com

Programming in C 1st Edition - eBook PDF

https://ebookluna.com/download/programming-in-c-ebook-pdf/

ebookluna.com

(eBook PDF) Computer Systems 5th Edition

https://ebookluna.com/product/ebook-pdf-computer-systems-5th-edition/

ebookluna.com
Computer Systems 5th Edition (eBook PDF)

https://ebookluna.com/product/computer-systems-5th-edition-ebook-pdf/

ebookluna.com

(eBook PDF) Computer Networks 6th Edition

https://ebookluna.com/product/ebook-pdf-computer-networks-6th-edition/

ebookluna.com

(eBook PDF) Linear Programming and Resource Allocation


Modeling

https://ebookluna.com/product/ebook-pdf-linear-programming-and-
resource-allocation-modeling/

ebookluna.com

(eBook PDF) Murach's C++ Programming by Joel Murach

https://ebookluna.com/product/ebook-pdf-murachs-c-programming-by-joel-
murach/

ebookluna.com

(eBook PDF) MATLAB Programming for Engineers 6th Edition

https://ebookluna.com/product/ebook-pdf-matlab-programming-for-
engineers-6th-edition/

ebookluna.com
As per
JNTU-Kakinada
Syllabus Regulation
2016

Computer
Programming
About the Author

E Balagurusamy, former Vice Chancellor, Anna University, Chennai and Member, Union Public Service
Commission, New Delhi, is currently the Chairman of EBG Foundation, Coimbatore. He is a teacher, trainer,
and consultant in the fields of Information Technology and Management. He holds an ME (Hons) in Electrical
Engineering and PhD in Systems Engineering from the Indian Institute of Technology (IIT) Roorkee. His
areas of interest include Object-Oriented Software Engineering, E-Governance: Technology Management,
Business Process Re-engineering, and Total Quality Management.
A prolific writer, he has authored a large number of research papers and several books. His best-selling
books, among others include:
∑ Programming in ANSI C, 7/e
∑ Fundamentals of Computers
∑ Computing Fundamentals and C Programming
∑ Programming in Java, 5/e
∑ Programming in BASIC, 3/e
∑ Programming in C#, 3/e
∑ Numerical Methods
∑ Reliability Engineering
∑ Introduction to Computing and Problem Solving using Python, 1e

A recipient of numerous honors and awards, E Balagurusamy has been listed in the Directory of Who's
Who of Intellectuals and in the Directory of Distinguished Leaders in Education.
As per
JNTU-Kakinada
Syllabus Regulation
2016

Computer
Programming

E Balagurusamy
Chairman
EBG Foundation
Coimbatore

McGraw Hill Education (India) Private Limited


CHENNAI

McGraw Hill Education Offices


Chennai New York St Louis San Francisco Auckland Bogotá Caracas
Kuala Lumpur Lisbon London Madrid Mexico City Milan Montreal
San Juan Santiago Singapore Sydney Tokyo Toronto
McGraw Hill Education (India) Private Limited

Published by McGraw Hill Education (India) Private Limited


444/1, Sri Ekambara Naicker Industrial Estate, Alapakkam, Porur, Chennai - 600 116

Computer Programming
Copyright © 2017 by McGraw Hill Education (India) Private Limited.
No part of this publication may be reproduced or distributed in any form or by any means, electronic, mechanical, photocopying,
recording, or otherwise or stored in a database or retrieval system without the prior written permission of the publishers.
The program listings (if any) may be entered, stored and executed in a computer system, but they may not be reproduced for
publication.
This edition can be exported from India only by the publishers,
McGraw Hill Education (India) Private Limited

Print Edition:
ISBN-13: 978-93-5260-388-6
ISBN-10: 93-5260-388-5

Managing Director: Kaushik Bellani


Director—Products (Higher Education and Professional): Vibha Mahajan
Manager—Product Development: Koyel Ghosh
Specialist—Product Development: Sachin Kumar
Head—Production (Higher Education and Professional): Satinder S Baveja
Assistant Manager—Production: Jagriti Kundu
AGM—Product Management (Higher Education and Professional): Shalini Jha
Manager—Product Management: Kartik Arora
General Manager—Production: Rajender P Ghansela
Manager—Production: Reji Kumar

Information contained in this work has been obtained by McGraw Hill Education (India), from sources believed to be reliable.
However, neither McGraw Hill Education (India) nor its authors guarantee the accuracy or completeness of any information
published herein, and neither McGraw Hill Education (India) nor its authors shall be responsible for any errors, omissions,
or damages arising out of use of this information. This work is published with the understanding that McGraw Hill Education
(India) and its authors are supplying information but are not attempting to render engineering or other professional services.
If such services are required, the assistance of an appropriate professional should be sought.

Typeset at The Composers, 260, C.A. Apt., Paschim Vihar, New Delhi 110 063 and printed at

Cover Printer:

Visit us at: www.mheducation.co.in


Contents

Preface xiii
Roadmap to the Syllabus xvi

Chapter 1 Introduction to Computers and Programming 1.1—1.30


1.1 Introduction 1.1
1.2 Computer Systems 1.2
1.2.1 Input Devices 1.3
1.2.2 CPU 1.5
1.2.3 Output Devices 1.6
1.2.4 Memory 1.8
1.3 History of C 1.12
1.4 Data Types 1.13
1.4.1 Integer Types 1.14
1.4.2 Floating Point Types 1.15
1.4.3 Void Types 1.16
1.4.4 Character Types 1.16
1.5 Programming Languages 1.16
1.5.1 Machine Language (Low Level Languages) 1.16
1.5.2 Assembly Language (Symbolic Language) 1.16
1.5.3 High-Level Languages 1.18
1.6 Development of C Algorithms 1.19
1.6.1 Characteristics of Algorithms 1.20
1.6.2 Advantages of Algorithms 1.20
1.6.3 Disadvantages of Algorithms 1.20
1.7 Software Development Method 1.22
1.7.1 Analysing the Requirements 1.23
1.7.2 Feasibility Analysis 1.23
1.7.3 Creating the Design 1.24
1.7.4 Developing Code 1.24
1.7.5 Testing the Software 1.25
1.7.6 Deploying the Software 1.25
1.7.7 Maintaining the Software 1.25
1.8 Applying Software Development Method 1.25
Key Terms 1.27
Just Remember 1.28
Multiple Choice Questions 1.28
vi Contents

Answers 1.29
Review Questions 1.29

Chapter 2 Basics of C 2.1—2.90


2.1 Importance of C 2.1
2.2 Basic Structure of C Programs 2.1
2.3 Programming Style 2.2
2.4 Executing a ‘C’ Program 2.3
2.5 Sample Programs 2.4
2.5.1 Sample Program 1: Printing a Message 2.4
2.5.2 Sample Program 2: Adding Two Numbers 2.6
2.5.3 Sample Program 3: Interest Calculation 2.8
2.5.4 Sample Program 4: Use of Subroutines 2.10
2.5.5 Sample Program 5: Use of Math functions 2.10
2.6 C Character Set 2.12
2.6.1 Trigraph Characters 2.13
2.7 C Tokens 2.14
2.8 Keywords and Identifiers 2.14
2.9 Operators and Expressions 2.15
2.9.1 Arithmetic Operators 2.15
2.9.2 Relational Operators 2.18
2.9.3 Logical Operators 2.19
2.9.4 Assignment Operators 2.20
2.9.5 Increment and Decrement Operators 2.22
2.9.6 Conditional Operator 2.23
2.9.7 Bitwise Operators 2.25
2.9.8 Special Operators 2.25
2.9.9 Operator Precedence 2.27
2.9.10 Precedence of Arithmetic Operators 2.29
2.9.11 Some Computational Problems 2.30
2.9.12 Type Conversions in Expressions 2.31
2.9.13 Operator Precedence and Associativity 2.34
2.10 Constants 2.36
2.10.1 Integer Constants 2.37
2.10.2 Real Constants 2.38
2.10.3 Single Character Constants 2.38
2.10.4 String Constants 2.39
2.11 Variables 2.40
2.12 Declaration of Variables 2.41
2.12.1 Primary Type Declaration 2.41
2.12.2 User-defined Type Declaration 2.42
2.12.3 Declaration of Storage Class 2.43
2.12.4 Assigning Values to Variables 2.44
Contents vii

2.13 ANSI C Library Functions 2.50


2.14 Managing Input and Output Operations 2.53
2.14.1 Reading a Character 2.54
2.14.2 Writing a Character 2.56
2.14.3 Formatted Input 2.58
2.14.4 Points to Remember while Using scanf 2.65
2.14.5 Formatted Output 2.66
2.15 Case Studies 2.71
Key Terms 2.78
Just Remember 2.79
Multiple Choice Questions 2.80
Answers 2.84
Review Questions 2.84
Debugging Exercises 2.86
Programming Exercise 2.87

Chapter 3 Decision Making, Branching and Looping 3.1—3.70


3.1 Introduction 3.1
3.2 Decision Making with If Statement 3.1
3.2.1 Simple If Statement 3.2
3.2.2 The If.....Else Statement 3.6
3.2.3 Nesting of If....Else Statements 3.9
3.2.4 The Else If Ladder 3.11
3.3 Decision Making with Switch Statement 3.15
3.4 The ? : Operator 3.20
3.5 Decision Making with Goto Statement 3.22
3.6 Introduction to Looping Procedure 3.25
3.6.1 Sentinel Loops 3.26
3.7 The While Statement 3.27
3.8 The Do Statement 3.29
3.9 The For Statement 3.33
3.9.1 Simple ‘for’ Loops 3.33
3.9.2 Additional Features of For Loop 3.37
3.9.3 Nesting of For Loops 3.39
3.10 Jumps In Loops 3.43
3.10.1 Jumping Out of a Loop 3.43
3.11 Case Studies 3.45
Key Terms 3.56
Just Remember 3.57
Multiple Choice Questions 3.58
Answers 3.60
Review Questions 3.61
Debugging Exercises 3.65
Programming Exercises 3.66
viii Contents

Chapter 4 User-Defined Functions 4.1—4.52


4.1 Introduction 4.1
4.2 Need for User-Defined Functions 4.1
4.3 A Multi-Function Program 4.2
4.3.1 Modular Programming 4.4
4.4 Category of Functions 4.5
4.4.1 No Arguments and No Return Values 4.5
4.4.2 Arguments but No Return Values 4.7
4.4.3 Arguments with Return Values 4.10
4.4.4 No Arguments but Returns a Value 4.16
4.4.5 Functions that Return Multiple Values 4.16
4.4.6 Nesting of Functions 4.17
4.5 Elements of User-Defined Functions 4.19
4.6 Definition of Functions 4.19
4.6.1 Function Header 4.20
4.6.2 Name and Type 4.20
4.6.3 Formal Parameter List 4.20
4.6.4 Function Body 4.21
4.7 Return Values and their Types 4.21
4.8 Function Calls 4.22
4.8.1 Function Call 4.24
4.9 Function Declaration 4.24
4.9.1 Prototypes: Yes or No 4.25
4.9.2 Parameters Everywhere! 4.25
4.10 Recursion 4.26
4.10.1 Recursion versus Iteration 4.27
4.11 Passing Arrays to Functions 4.27
4.11.1 One-Dimensional Arrays 4.27
4.11.2 Two-Dimensional Arrays 4.31
4.12 Passing Strings to Functions 4.32
4.12.1 Pass by Value versus Pass by Pointers 4.32
4.13 The Scope, Visibility, and Lifetime of Variables 4.33
4.13.1 Automatic Variables 4.33
4.13.2 External Variables 4.35
4.13.3 External Declaration 4.37
4.13.4 Static Variables 4.39
4.13.5 Register Variables 4.40
4.14 Multifile Programs 4.42
4.15 Case Study 4.43
Key Terms 4.46
Just Remember 4.46
Multiple Choice Questions 4.47
Contents ix

Answers 4.48
Review Questions 4.49
Debugging Exercises 4.51
Programming Exercises 4.51

Chapter 5 Arrays 5.1—5.44


5.1 Introduction 5.1
5.1.1 Data Structures 5.2
5.2 One-Dimensional Arrays 5.2
5.3 Declaration of One-dimensional Arrays 5.3
5.4 Initialization of One-dimensional Arrays 5.6
5.4.1 Compile Time Initialization 5.6
5.4.2 Run Time Initialization 5.7
5.4.3 Searching and Sorting 5.11
5.5 Two-Dimensional Arrays 5.12
5.6 Initializing Two-Dimensional Arrays 5.16
5.6.1 Memory Layout 5.19
5.7 Multi-Dimensional Arrays 5.25
5.8 Dynamic Arrays 5.26
5.9 Case Studies 5.26
Key Terms 5.38
Just Remember 5.38
Multiple Choice Questions 5.39
Answers 5.40
Review Questions 5.40
Debugging Exercises 5.41
Programming Exercises 5.42

Chapter 6 Strings 6.1—6.34


6.1 Introduction 6.1
6.2 Declaring and Initializing String Variables 6.2
6.3 Reading Strings from Terminal 6.3
6.3.1 Using scanf Function 6.3
6.3.2 Reading a Line of Text 6.5
6.3.3 Using getchar and gets Functions 6.6
6.4 Writing Strings to Screen 6.11
6.4.1 Using printf Function 6.11
6.4.2 Using putchar and puts Functions 6.14
6.5 Arithmetic Operations on Characters 6.15
6.6 Putting Strings Together 6.16
6.7 Comparison of Two Strings 6.18
6.8 String-Handling Functions 6.18
6.8.1 strcat() Function 6.18
x Contents

6.8.2 strcmp() Function 6.19


6.8.3 strcpy() Function 6.20
6.8.4 strlen() Function 6.20
6.8.5 Other String Functions 6.22
6.9 Table of Strings 6.24
6.10 Case Studies 6.26
Key Terms 6.30
Just Remember 6.30
Multiple Choice Questions 6.30
Answers 6.31
Review Questions 6.31
Debugging Exercises 6.33
Programming Exercises 6.33

Chapter 7 Pointers 7.1—7.42


7.1 Introduction 7.1
7.2 Understanding Pointers 7.2
7.2.1 Underlying Concepts of Pointers 7.3
7.3 Initialization of Pointer Variables 7.3
7.3.1 Pointer Flexibility 7.4
7.4 Declaring Pointer Variables 7.5
7.4.1 Pointer Declaration Style 7.5
7.5 Accessing the Address of a Variable 7.6
7.6 Accessing a Variable Through its Pointer 7.8
7.7 Chain of Pointers 7.10
7.8 Pointer Expressions 7.11
7.9 Pointer Increments and Scale Factor 7.12
7.9.1 Rules of Pointer Operations 7.13
7.10 Pointers as Function Arguments 7.13
7.11 Functions Returning Pointers 7.16
7.12 Pointers to Functions 7.17
7.12.1 Compatibility and Casting 7.19
7.13 Pointers and Arrays 7.19
7.14 Pointers and Character Strings 7.23
7.15 Array of Pointers 7.25
7.16 Dynamic Memory Allocation 7.26
7.17 Allocating a Block of Memory: Malloc 7.27
7.18 Allocating Multiple Blocks of Memory: Calloc 7.29
7.19 Releasing the Used Space: Free 7.33
7.20 Case Studies 7.33
Key Terms 7.38
Just Remember 7.38
Multiple Choice Questions 7.39
Contents xi

Answers 7.40
Review Questions 7.40
Debugging Exercises 7.42
Programming Exercise 7.42

Chapter 8 Structures and Unions 8.1—8.59


8.1 Introduction 8.1
8.2 Defining a Structure 8.1
8.3 Declaring Structure Variables 8.2
8.3.1 Accessing Structure Members 8.4
8.4 Structure Initialization 8.5
8.5 Arrays of Structures 8.8
8.5.1 Arrays Within Structures 8.11
8.5.2 Structures Within Structures 8.13
8.6 Structures and Functions 8.15
8.6.1 Passing Structure Through Pointers 8.17
8.6.2 Self Referential Structure 8.18
8.7 Pointers and Structures 8.18
8.8 Unions 8.21
8.9 Bit Fields 8.23
8.10 Typedef 8.25
8.11 Command Line Arguments 8.37
8.11.1 Application of Command Line Arguments 8.48
8.12 Case Study 8.50
Key Terms 8.53
Just Remember 8.53
Multiple Choice Questions 8.54
Answers 8.54
Review Questions 8.55
Debugging Exercises 8.57
Programming Exercise 8.58

Chapter 9 Data Files 9.1—9.22


9.1 Introduction 9.1
9.2 Defining and Opening a File 9.2
9.3 Closing a File 9.3
9.4 Input/Output Operations on Files 9.4
9.4.1 The getc and putc Functions 9.4
9.4.2 The getw and putw Functions 9.8
9.4.3 The fprintf and fscanf Functions 9.10
9.5 Error Handling During I/O Operations 9.12
9.6 Random Access to Files 9.14
Key Terms 9.20
xii Contents

Just Remember 9.20


Multiple Choice Questions 9.21
Answers 9.21
Review Questions 9.21
Debugging Exercise 9.22
Programming Exercise 9.22

Appendix 1 C99/C11 Features A1.1—A1.8


Solved Question Paper Nov-Dec 2015 (Set 1— Set 4) SQP1—SQP32
Solved Question Paper May 2016 (Set 1— Set 4) SQP1—SQP29
Preface

INTRODUCTION
Computers plays an increasing important role in today’s world and a sound knowledge of computers has
become indispensable for anyone who seeks employment not only in the area of IT but also in any other
field as well. Computer programming is dedicated to the understanding of computer language, and writing
and testing of programs that computers’ follow to perform their functions. The programs are created using
programming languages and C is the most prevalent, efficient and compact programming language. C
combines the features of a high-level language with the elements of the assembler and is thus close to both
man and machine. The growth of C during the last few years has been phenomenal. It has emerged as the
language of choice for most applications due to its speed, portability and compactness of code. Thus, many
institutions and universities in India have introduced a subject covering Computer Programming.
This book is specially designed for first-year students of Jawaharlal Nehru Technological University
Kakinada (JNTU K) and would enable them to master the necessary skills for programming with C language.
The text has been infused with numerous examples and case studies to empower the learner. Furthermore, the
book also covers design and implementation aspect of data structures using standard ANSI C programming
language.

SIGNIFICANT FEATURES
∑ New! Completely in sync with the syllabus of JNTU Kakinada (2016 Regulation)
∑ New! Incorporates all the features of ANSI C that are essential for a C programmer.
∑ New! Solutions to latest 2015 (Nov/Dec) and 2016 (May) JNTU Kakinada question paper is placed
at the end of the book (All 4 sets)
∑ New! 149 Multiple Choice Questions incorporated at the end of each chapters help students tests
their conceptual understanding of the subject
∑ 22 Case Studies in relevant chapters with stepwise solution to demonstrate real-life applications
∑ New! Updated information on C99/C11 features
∑ New! Topics like ANSI C library functions, Negation, Swapping Values, Recursion v/s Iteration are
covered in detail
∑ Learning by example approach ensures smooth and successful transition from a learner to a skilled
C programmer
∑ Enhanced student-friendly chapter design including Outline, Introduction, Section-end Solved
Programs, Case Studies, Key Terms, Just Remember, Multiple Choice Questions, Review Questions,
Debugging Exercises, Programming Exercises
∑ Special box feature highlighting supplementary information that complements the text.
xiv Preface

PEDAGOGICAL FEATURES
∑ 134 Solved C Programs demonstrate the general principles of good programming style
∑ 171 Review Questions helps in testing conceptual understanding
∑ 28 Debugging Exercise helps in participating coding contests
∑ 179 Programming Exercises simulate interest to practice programming applications

CHAPTER ORGANIZATION
The content is spread across 9 chapters. Chapter 1 introduces computer systems, programming languages
and environment, software development method, and algorithms. Chapter 2 gives an overview of C and
explaining the keywords, identifiers, constants, variables, data types and various case studies on these.
Chapters 3 comprises of decision-making, branching and looping methods. Chapter 4 covers the functions
which are used in C language. Chapter 5 focuses on arrays while Chapter 6 deals with strings. Different
types of pointers and its types are discussed in Chapter 7. Chapter 8 presents structures and unions while
Chapter 9 covers file types and their management. Appendix 1 covers C99/C11 features in detail. In addition
to all this, Solved Question Papers of Nov/Dec 2015 (4 sets) and May 2016 (4 sets) are also given in this
book.

CD RESOURCES
The supplementary CD provided along with the book would help the students master programming language
and write their own programs using Computer programming concepts and data structures. The CD comprises
of the following resources:
∑ New! 2012, 2013, 2014, Jan/Feb 2015 solved question papers
∑ New! Lab Programs as per the new syllabus
∑ Two major programming projects—Inventory and Record Entry & two mini projects—Linked List
and Matrix Multiplication
∑ 100 Programming Exercises and 200 Objective Type Questions aligned as per the new syllabus
∑ 5 Solved Model Question Papers
∑ 79 Additional Solved Programs
∑ Additional content on Matrix Operation

ACKNOWLEDGEMENTS
A number of reviewers took pains to provide valuable feedback for the book. We are grateful to all of them
and their names are mentioned as follows:
S. Krishna Rao Sir CR Reddy College of Engineering, Eluru, Andhra Pradesh
Narasimha Rao Kandula Vishnu Institute of Technology, Bhimavaram, Andhra Pradesh
K. Phani Babu, Chundru Raja Ramesh Sri Vasavi Engineering College, Tadepalligudem, Andhra
Pradesh
Preface xv

Rama Rao Adimalla Lendi Institute of Engineering and Technology, Jonnada,


Andhra Pradesh
S. Rama Sree Aditya Engineering College, Peddapuram, Andhra Pradesh
M V S S Nagendranath Sasi Institute of Technology & Engineering, Tadepalligudem,
Andhra Pradesh
S. Satyanarayana Raghu Engineering College, Dakamarri, Andhra Pradesh
S C Satapathy Anil Neerukonda Institute of Technology and Sciences,
Visakhapatnam, Andhra Pradesh
Ch Vijaya Kumar DVR & Dr. HS MIC College of Technology, Kanchikacherla,
Andhra Pradesh

E Balagurusamy

Publisher’s Note
McGraw Hill Education (India) invites suggestions and comments, all of which can be sent to
info.india@mheducation.com (kindly mention the title and author name in the subject line).
Piracy-related issues may also be reported.
Roadmap to the Syllabus

Computer Programming
Revised Course from Academic Year 2016-2017

Unit 1: History and Hardware—Computer hardware, Bits and bytes, Components, Programming
Languages—machine language, assembly language, low-level and high-level languages, procedural and
object-oriented languages, Application and system software, Development of C algorithms, Software
development process

Go to
Chapter 1: Introduction to Computers and Programming

Unit 2: Introduction to C programming, Identifiers, main () function, printf () function, Programming


style, Indentation, Comments, Data types, Arithmetic operations, Expression types, Variables and
declarations, Negation, Operator precedence and associativity, Declaration statements, Initialization
assignment, Implicit type conversions, Explicit type conversions, Assignment variations, Mathematical
library functions, Interactive input, Formatted output, Format modifiers

Go to
Chapter 1: Introduction to Computers and Programming
Chapter 2: Basics of C

Unit 3: Control flow-relational expressions—logical operators, Selection—if-else statement—nested if,


examples—multi-way selection—switch—else-if, examples, Repetition—basic loop structures, Pretest
and post-test loops, Counter-controlled and condition-controlled loops, While statement, For statement,
Nested loops, do-while statement

Go to
Chapter 3: Decision Making, Branching and Looping
Roadmap to the Syllabus xvii

Unit 4: Modular programming: function and parameter declarations, Returning a value, Functions with
empty parameter lists, Variable scope, Variable storage class, Local variable storage classes, Global
variable storage classes, Pass by reference, Passing addresses to a function, Storing addresses variables,
Using addresses, Declaring and using pointers, Passing addresses to a function, Swapping values,
Recursion—mathematical recursion—recursion versus iteration.

Go to
Chapter 4: User-Defined Functions

Unit 5: One-dimensional arrays, Input and output of array values, Array initialization, Arrays as function
arguments, Two-dimensional arrays, Larger dimensional arrays—matrices, String fundamentals, Library
functions, String input and output, String processing

Go to
Chapter 5: Arrays
Chapter 6: Strings

Unit 6: Pointers—concept of a pointer, Initialisation of pointer variables, Pointers as function arguments,


Passing by address, Dangling memory, Address arithmetic, Character pointers and Functions, Pointers to
pointers, Dynamic memory management functions, Command line arguments
Structures—derived types, Structures declaration, Initialization of structures, Accessing structures,
Nested structures, Arrays of structures, structures and functions, Pointers to structures, self-referential
structures, Unions, typedef, bit-fields
Declaring, Opening, and Closing file streams, Reading from and Writing to text files, Random file
access

Go to
Chapter 7: Pointers
Chapter 8: Structures and Unions
Chapter 9: Data Files
Introduction to Computers
1 and Programming

CHAPTER OUTLINE
1.1 Introduction 1.4 Data Types 1.7 Software Development Method
1.2 Computer Systems 1.5 Programming Languages 1.8 Applying Software
1.3 History of C 1.6 Development of C Algorithms Development Method

1.1 INTRODUCTION
The term computer is derived from the word
compute. A computer is an electronic device Data INPUT PROCESS
OUTPUT
Information
that takes data and instructions as an input
from the user, processes data, and provides
useful information known as output. This
cycle of operation of a computer is known as Instructions
the input–process–output cycle and is shown Fig. 1.1 Input–process–output concept
in Fig. 1.1. The electronic device is known as
hardware and the set of instructions is known as software.
A computer consists of various components that function as an integrated system to perform computational
tasks. These components include the following:
Central Processing Unit (CPU) It is the brain of the computer that is responsible for controlling
and executing program instructions.
Monitor It is a display screen, which shows information in visual form.
Keyboard and Mouse These are the peripheral devices used by the computer for receiving inputs
from the user.
Figure 1.2 shows the various components of a computer.
The unique capabilities and characteristics of a computer have made it very popular among its various
users, including engineers, managers, accountants, teachers, students, etc.
Some of the key characteristics of a modern digital computer include, among others the following:
Speed The computer is a fast electronic device that can solve large and complex problems in few
seconds. The speed of a computer generally depends upon its hardware configuration.
Storage capacity A computer can store huge amounts of data in many different formats. The storage
area of a computer system is generally divided into two categories, main memory and secondary storage.
1.2 Computer Programming

Monitor
CPU

Keyboard

Mouse

Fig. 1.2 Components of a computer

Accuracy A computer carries out calculations with great accuracy. The accuracy achieved by a
computer depends upon its hardware configuration and the specified instructions.
Reliability A computer produces results with no error. Most of the computer-generated errors are
in actuality human errors that are instigated by the user itself. Therefore, computers are regarded as
quite trustworthy machines.
Versatility Computers are versatile machines. They can perform varied tasks and can be used for
many different purposes.
Diligence Computers can perform repetitive calculations any number of times with the same level
of accuracy.
These capabilities of computers have enabled us to use them for a variety of tasks. Application areas may
broadly be classified into the following major categories.
1. Data processing (commercial use)
2. Numerical computing (scientific use)
3. Text (word) processing (office and educational use)
4. Message communication (e-mail)
5. Image processing (animation and industrial use)
6. Voice recognition (multimedia)

1.2 COMPUTER SYSTEMS


A computer system comprises of hardware and software components. Hardware refers to the physical
parts of the computer system and software is the set of instructions or programs that are necessary for the
functioning of a computer to perform certain tasks. Hardware includes the following components:
Input devices They are used for accepting the data on which the operations are to be performed.
The examples of input devices are keyboard, mouse and track ball.
Processor Also known as CPU, it is used to perform the calculations and information processing on
the data that is entered through the input device.
Output devices They are used for providing the output of a program that is obtained after performing
the operations specified in a program. The examples of output devices are monitor and printer.
Memory It is used for storing the input data as well as the output of a program that is obtained
after performing the operations specified in a program. Memory can be primary memory as well
as secondary memory. Primary memory includes Random Access Memory (RAM) and secondary
memory includes hard disks and floppy disks.
Introduction to Computers and Programming 1.3

Software supports the functioning of a computer system internally and cannot be seen. It is stored on
secondary memory and can be an application software as well as system software. The application software
is used to perform a specific task according to requirements and the system software is mandatory for running
application software. The examples of application software include Excel and MS Word and the examples of
system software include operating system and networking system.
All the hardware components interact with each other as well as with the software. Similarly, the different
types of software interact with each other and with the hardware components. The interaction between
various hardware components is illustrated in Fig. 1.3.

1.2.1 Input Devices


Input devices can be connected to the computer system using cables. The most commonly used input devices
among others are:

Magnetic Magnetic
Tape Disk

EXTERNAL STORAGE UNITS

Input Input Memory Output Output


Media Unit Unit Unit Media

Arithmetic
Unit

Control
Data and results flow
Unit
Control Instructions to units
Instructions to control unit
CPU

Fig. 1.3 Interaction among hardware components

Keyboard
A standard keyboard includes alphanumeric keys, function keys, modifier keys, cursor movement keys,
spacebar, escape key, numeric keypad, and some special keys, such as Page Up, Page Down, Home, Insert,
Delete and End. The alphanumeric keys include the number keys and the alphabet keys. The function keys
are the keys that help perform a specific task such as searching a file or refreshing a Web page. The modifier
keys such as Shift and Control keys modify the casing style of a character or symbol. The cursor movement
1.4 Computer Programming

keys include up, down, left and right keys and are used to modify the direction of the cursor on the screen.
The spacebar key shifts the cursor to the right by one position. The numeric keypad uses separate keypads for
numbers and mathematical operators. A keyboard is show in Fig. 1.4.

Function Keys
(F1 to F12)
Escape Key
Special Keys

Numeric Keypad

Modifier Keys

Alphanumeric Spacebar Key Cursor Movement


Keys Keys

Fig. 1.4 Keyboard

Mouse
Wheel
The mouse allows the user to select elements on the screen, Right Button
such as tools, icons, and buttons, by pointing and clicking Left Button
them. We can also use a mouse to draw and paint on the
screen of the computer system. The mouse is also known
as a pointing device because it helps change the position of
the pointer or cursor on the screen.
The mouse consists of two buttons, a wheel at the top and
a ball at the bottom of the mouse. When the ball moves, the Fig. 1.5 Mouse
cursor on the screen moves in the direction in which the ball rotates. The left button of the mouse is used to select
an element and the right button, when clicked, displays the special options such as open and explore and shortcut
menus. The wheel is used to scroll down in a document or a Web page. A mouse is shown in Fig. 1.5.

Scanner
A scanner is an input device that converts documents and images as the
digitized images understandable by the computer system. The digitized
images can be produced as black and white images, gray images, or
colored images. In case of colored images, an image is considered
as a collection of dots with each dot representing a combination of
red, green, and blue colors, varying in proportions. The proportions
of red, green, and blue colors assigned to a dot are together called as
color description. The scanner uses the color description of the dots to
produce a digitized image. Fig. 1.6 shows a scanner.
There are the following types of scanners that can be used to
produce digitized images: Fig. 1.6 Scanner
Flatbed scanner It contains a scanner head that moves across a page from top to bottom to read the
page and converts the image or text available on the page in digital form. The flatbed scanner is used
to scan graphics, oversized documents, and pages from books.
Introduction to Computers and Programming 1.5

Drum scanner In this type of scanner, a fixed scanner head is used and the image to be scanned is
moved across the head. The drum scanners are used for scanning prepress materials.
Slide scanner It is a scanner that can scan photographic slides directly to produce files understandable
by the computer.
Handheld scanner It is a scanner that is moved by the end user across the page to be scanned. This
type of scanner is inexpensive and small in size.

1.2.2 CPU
The CPU consists of Control Unit (CU) and ALU. CU stores the instruction set, which specifies the operations
to be performed by the computer. CU transfers the data and the instructions to the ALU for an arithmetic
operation. ALU performs arithmetical or logical operations on the data received. The CPU registers store the
data to be processed by the CPU and the processed data also. Apart from CU and ALU, CPU seeks help from
the following hardware devices to process the data:

Motherboard
It refers to a device used for connecting the CPU with the input and output devices (Fig. 1.7). The components
on the motherboard are connected to all parts of a computer and are kept insulated from each other. Some of
the components of a motherboard are:
Buses Electrical pathways that transfer data and instructions among different parts of the computer.
For example, the data bus is an electrical pathway that transfers data among the microprocessor,
memory and input/output devices connected to the computer. The address bus is connected among
the microprocessor, RAM and Read Only Memory (ROM), to transfer addresses of RAM and ROM
locations that is to be accessed by the microprocessor.
System clock It is a clock used for synchronizing the activities performed by the computer. The
electrical signals that are passed inside a computer are timed, based on the tick of the clock. As a
result, the faster the system clock, the faster is the processing speed of the computer.

Fig. 1.7 A motherboard


1.6 Computer Programming

Microprocessor CPU component that performs the processing and controls the activities performed
by the different parts of the computer. The microprocessor is plugged to the CPU socket placed on the
motherboard.
ROM Chip that contains the permanent memory of the computer that stores information, which
cannot be modified by the end user.

Random Access Memory (RAM)


It refers to primary memory of a computer that stores information and programs, until the computer is used.
RAM is available as a chip that can be connected to the RAM slots in the motherboard.

Video Card/Sound card


The video card is an interface between the monitor and the CPU. Video cards also include their own RAM
and microprocessors that are used for speeding up the processing and display of a graphic. These video cards
are placed on the expansion slots, as these slots allow us to connect the high-speed graphic display cards to
the motherboard. A sound card is a circuit board placed on the motherboard and is used to enhance the sound
capabilities of a computer. The sound cards are plugged to the Peripheral Component Interconnect (PCI)
slots. The PCI slots also enable the connection of networks interface card, modem cards and video cards, to
the motherboard.

1.2.3 Output Devices


The data, processed by the CPU, is made available to the end user by the output devices. The most commonly
used output devices are:

Monitor
A monitor is the most commonly used output device that produces
visual displays generated by the computer (Fig. 1.8). The monitor,
also known as a screen, is connected as an external device using
cables or connected either as a part of the CPU case. The monitor
connected using cables, is connected to the video card placed on the
expansion slot of the motherboard. The display device is used for
visual presentation of textual and graphical information.
The monitors can be classified as cathode ray tube (CRT) monitors
or liquid crystal display (LCD) monitors. The CRT monitors are
large, occupy more space in the computer, whereas LCD monitors
are thin, light weighted, and occupy lesser space. Both the monitors
are available as monochrome, gray scale and color models. However,
the quality of the visual display produced by the CRT is better than Fig. 1.8 Monitor
that produced by the LCD.
Introduction to Computers and Programming 1.7

A monitor can be characterized by its monitor size and resolution. The monitor size is the length of
the screen that is measured diagonally. The resolution of the screen is expressed as the number of picture
elements or pixels of the screen. The resolution of the monitor is also called the dot pitch. The monitor with
a higher resolution produces a clearer image.

Printer
The printer is an output device that is used to produce a hard copy
of the electronic text displayed on the screen, in the form of paper
sheets that can be used by the end user (Fig. 1.9). The printer is an
external device that is connected to the computer system using cables.
The computer needs to convert the document that is to be printed to
data that is understandable by the printer. The printer driver software
or the print driver software is used to convert a document to a form
understandable by the computer. When the computer components are
upgraded, the upgraded printer driver software needs to be installed on Fig. 1.9 Printer
the computer.
The performance of a printer is measured in terms of dots per inch (DPI) and pages per minute (PPM)
produced by the printer. The greater the DPI parameter of a printer, the better is the quality of the output
generated by it. The higher PPM represents higher efficiency of the printer. Printers can be classified based
on the technology they use to print the text and images:
Dot matrix printers Dot matrix printers are impact printers that use perforated sheet to print the
text. The process to print a text involves striking a pin against a ribbon to produce its impression on
the paper.
Inkjet printers Inkjet printers are slower than dot matrix printers and are used to generate high
quality photographic prints. Inkjet printers are not impact printers. The ink cartridges are attached to
the printer head that moves horizontally, from left to right.
Laser printers The laser printer may or may not be connected to a computer, to generate an output.
These printers consist of a microprocessor, ROM and RAM, which can be used to store the textual
information. The printer uses a cylindrical drum, a toner and the laser beam.

Speaker
The speaker is an electromechanical transducer that converts an
electrical signal into sound (Fig. 1.10). They are attached to a computer
as output devices, to provide audio output, such as warning sounds and
Internet audios. We can have built-in speakers or attached speakers in a
computer to warn end users with error audio messages and alerts. The
audio drivers need to be installed in the computer to produce the audio
output. The sound card being used in the computer system decides the
quality of audio that we listen using music CDs or over the Internet.
The computer speakers vary widely in terms of quality and price. The
sophisticated computer speakers may have a subwoofer unit, to enhance
bass output. Fig. 1.10 Speakers
Other documents randomly have
different content
"Can't you leave it behind?"
"No; the new landlord won't let me. Says the Japanese have no use
for American furniture—unpleasant in the houses during
earthquakes, etc."
"Well, I'll take care of them for you," Sinclair volunteered, good-
naturedly.
"Oh, will you? Now, that will be good of you. That settles that, then.
And now about this stuff—come on, Tom," she began crushing
things into boxes and trunks, in her quick, delightful fashion, scarce
noting where she was placing them. She paused a moment to ask
Sinclair if he had been over to Numè's.
"Yes," he smiled a trifle. "Cleo is there now."
She dropped a piece of bric-a-brac and sat down on the floor.
"Cleo! there—with Numè! Well!"
"Yes, she wanted to know Numè, she said, before going away,"
Sinclair told her.
"She will never cease surprising me," Mrs. Davis said, plaintively.
"She ought not to excite herself. I never know what to expect of her,
which way to take her. I used to think my nerves were strong; now—
my nerves are—are nervous."
"Cleo is not herself lately," Tom said, quietly, without looking up.
"We'd better humor her for a little while still. Besides—Numè will do
her good, I believe."
CHAPTER LIX.
CLEO AND NUMÈ.

As soon as Sinclair left them the Japanese girl went close up to the
American girl.
"Sa-ay—I goin' tell you something," she said, confidingly.
"Yes, dear."
"You mos' beautifoolest womans barbarian—No! no! nod thad.
Egscuse me. I nod perlite to mag' mistakes sometimes. I mean I
thing' you mos' beautifoolest ladies I aever seen," she said.
Again Cleo smiled. Numè wished she would say something.
"You lig' me?" she prompted, encouragingly.
"Yes——"
"Foraever an' aever?"
"Well—yes—I guess so."
"How nize!" she clapped her hands and Koto came through the
parted shoji.
"Now I interducing you to my mos' vaery nize friens, Mees Tominago
Koto."
Koto was as anxious as Numè to please, and as she had seen Numè
hold her two hands out in greeting, she did the same, very sweetly.
About an hour later Mrs. Davis, with Tom and Sinclair, looked in at
the three girls. Cleo was sitting on the mats with Koto and Numè,
and they were all laughing.
"Well, we've come for the invalid," said Tom, cheerily. "She has been
out long enough."
"I have enjoyed my visit," she told them, simply. "And Numè," she
turned to her, "Numè, will you kiss me?"
"Ess;" she paused a moment, bashfully, throwing a charming glance
at Sinclair. "I kin kees—Mr. Sinka tich me."
They all laughed at this.
"An' now," she continued, "I inviting you to visit with me agin." She
included them all with a bewitching little sweep of her hands, but
her eyes were on the American girl's face. "An' also I lig' you to
know thad Mr. Sinka promising to me thad he goin' tek me thad
grade big United States. Now, thad will be nize. I egspeg you lig' me
visite with you also. Yaes?"
"Of course; you would stay with us," Tom said, cordially.
"Thad is perlite," she breathed, ecstatically.
"Not polite, Numè," Sinclair corrected, smiling, "but, well—'nize,' as
you would call it."
"Ah, yaes, of course. I beg pardons, egscuse. I mean thad liddle
word 'nize.' Tha's foolish say 'perlite.'" She laughed at what she
thought her own foolishness, and she was so pretty when she
laughed.
Cleo turned to Sinclair. "I understand," she said, softly, "why you—
you loved her. If I were a man I would too."
"Ah! thad is a regret," sighed Numè, who had overheard her and
half understood. "Thad you nod a mans to luf with me. Aenyhow, I
thing' I liging you without thad I be a mans. Sa-ay, I lig' you jus' lig'
a—a brudder—no, lig' a mudder, with you." This was very generous,
as the mother love is supreme in Japan, and Numè felt she could not
go beyond that.
Cleo seemed very much absorbed on the way home. Tom was in the
kurumma with her, Sinclair having stayed behind a while.
"Matsu is going back with us to America," she said. "I think she is a
dear little thing, and I shall educate her." She was silent a moment,
and then she said, very wistfully:
"Tom, do you suppose I can ever make up—atone for all my
wickedness?" and Tom answered her with all the old loving
sympathy.
"I never could think of you as wicked, sis—not wantonly so—only
thoughtless."
"Ah, Tom—if I could only think so too!"
When the boat moved down the bay Cleo's and Tom's eyes were
dim, and when the wharf was only a shadowy, dark line they still
leaned forward watching a small white fluttering handkerchief, and
in imagination they still saw the little doleful figure trying to smile up
at them through a mist of tears.
And a week later the selfsame missionary who had given Sinclair so
much work, and thereby helped him bear his trouble, married them
—Sinclair and Numè. The girl was gowned all in white—the dress
she had worn that first time Sinclair had met her.
About two years later a party of American tourists called on Sinclair.
Among them were a few old acquaintances. They brought strange
news. Cleo and Tom Ballard had been married for a month past!
Perhaps the most frequent visitors at the Sinclairs' are Mr. and Mrs.
Shiku.

THE END.
*** END OF THE PROJECT GUTENBERG EBOOK MISS NUMÈ OF
JAPAN: A JAPANESE-AMERICAN ROMANCE ***

Updated editions will replace the previous one—the old editions


will be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States
copyright in these works, so the Foundation (and you!) can copy
and distribute it in the United States without permission and
without paying copyright royalties. Special rules, set forth in the
General Terms of Use part of this license, apply to copying and
distributing Project Gutenberg™ electronic works to protect the
PROJECT GUTENBERG™ concept and trademark. Project
Gutenberg is a registered trademark, and may not be used if
you charge for an eBook, except by following the terms of the
trademark license, including paying royalties for use of the
Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such
as creation of derivative works, reports, performances and
research. Project Gutenberg eBooks may be modified and
printed and given away—you may do practically ANYTHING in
the United States with eBooks not protected by U.S. copyright
law. Redistribution is subject to the trademark license, especially
commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the


free distribution of electronic works, by using or distributing this
work (or any other work associated in any way with the phrase
“Project Gutenberg”), you agree to comply with all the terms of
the Full Project Gutenberg™ License available with this file or
online at www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand,
agree to and accept all the terms of this license and intellectual
property (trademark/copyright) agreement. If you do not agree
to abide by all the terms of this agreement, you must cease
using and return or destroy all copies of Project Gutenberg™
electronic works in your possession. If you paid a fee for
obtaining a copy of or access to a Project Gutenberg™
electronic work and you do not agree to be bound by the terms
of this agreement, you may obtain a refund from the person or
entity to whom you paid the fee as set forth in paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only


be used on or associated in any way with an electronic work by
people who agree to be bound by the terms of this agreement.
There are a few things that you can do with most Project
Gutenberg™ electronic works even without complying with the
full terms of this agreement. See paragraph 1.C below. There
are a lot of things you can do with Project Gutenberg™
electronic works if you follow the terms of this agreement and
help preserve free future access to Project Gutenberg™
electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright
law in the United States and you are located in the United
States, we do not claim a right to prevent you from copying,
distributing, performing, displaying or creating derivative works
based on the work as long as all references to Project
Gutenberg are removed. Of course, we hope that you will
support the Project Gutenberg™ mission of promoting free
access to electronic works by freely sharing Project Gutenberg™
works in compliance with the terms of this agreement for
keeping the Project Gutenberg™ name associated with the
work. You can easily comply with the terms of this agreement
by keeping this work in the same format with its attached full
Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.

1.E. Unless you have removed all references to Project


Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project
Gutenberg™ work (any work on which the phrase “Project
Gutenberg” appears, or with which the phrase “Project
Gutenberg” is associated) is accessed, displayed, performed,
viewed, copied or distributed:

This eBook is for the use of anyone anywhere in the United


States and most other parts of the world at no cost and
with almost no restrictions whatsoever. You may copy it,
give it away or re-use it under the terms of the Project
Gutenberg License included with this eBook or online at
www.gutenberg.org. If you are not located in the United
States, you will have to check the laws of the country
where you are located before using this eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is


derived from texts not protected by U.S. copyright law (does not
contain a notice indicating that it is posted with permission of
the copyright holder), the work can be copied and distributed to
anyone in the United States without paying any fees or charges.
If you are redistributing or providing access to a work with the
phrase “Project Gutenberg” associated with or appearing on the
work, you must comply either with the requirements of
paragraphs 1.E.1 through 1.E.7 or obtain permission for the use
of the work and the Project Gutenberg™ trademark as set forth
in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is


posted with the permission of the copyright holder, your use and
distribution must comply with both paragraphs 1.E.1 through
1.E.7 and any additional terms imposed by the copyright holder.
Additional terms will be linked to the Project Gutenberg™
License for all works posted with the permission of the copyright
holder found at the beginning of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files
containing a part of this work or any other work associated with
Project Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute


this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™
works unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or


providing access to or distributing Project Gutenberg™
electronic works provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project


Gutenberg™ electronic work or group of works on different
terms than are set forth in this agreement, you must obtain
permission in writing from the Project Gutenberg Literary
Archive Foundation, the manager of the Project Gutenberg™
trademark. Contact the Foundation as set forth in Section 3
below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on,
transcribe and proofread works not protected by U.S. copyright
law in creating the Project Gutenberg™ collection. Despite these
efforts, Project Gutenberg™ electronic works, and the medium
on which they may be stored, may contain “Defects,” such as,
but not limited to, incomplete, inaccurate or corrupt data,
transcription errors, a copyright or other intellectual property
infringement, a defective or damaged disk or other medium, a
computer virus, or computer codes that damage or cannot be
read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except


for the “Right of Replacement or Refund” described in
paragraph 1.F.3, the Project Gutenberg Literary Archive
Foundation, the owner of the Project Gutenberg™ trademark,
and any other party distributing a Project Gutenberg™ electronic
work under this agreement, disclaim all liability to you for
damages, costs and expenses, including legal fees. YOU AGREE
THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE, STRICT
LIABILITY, BREACH OF WARRANTY OR BREACH OF CONTRACT
EXCEPT THOSE PROVIDED IN PARAGRAPH 1.F.3. YOU AGREE
THAT THE FOUNDATION, THE TRADEMARK OWNER, AND ANY
DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE
TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL,
PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE
NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of
receiving it, you can receive a refund of the money (if any) you
paid for it by sending a written explanation to the person you
received the work from. If you received the work on a physical
medium, you must return the medium with your written
explanation. The person or entity that provided you with the
defective work may elect to provide a replacement copy in lieu
of a refund. If you received the work electronically, the person
or entity providing it to you may choose to give you a second
opportunity to receive the work electronically in lieu of a refund.
If the second copy is also defective, you may demand a refund
in writing without further opportunities to fix the problem.

1.F.4. Except for the limited right of replacement or refund set


forth in paragraph 1.F.3, this work is provided to you ‘AS-IS’,
WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of
damages. If any disclaimer or limitation set forth in this
agreement violates the law of the state applicable to this
agreement, the agreement shall be interpreted to make the
maximum disclaimer or limitation permitted by the applicable
state law. The invalidity or unenforceability of any provision of
this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the


Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and
distribution of Project Gutenberg™ electronic works, harmless
from all liability, costs and expenses, including legal fees, that
arise directly or indirectly from any of the following which you
do or cause to occur: (a) distribution of this or any Project
Gutenberg™ work, (b) alteration, modification, or additions or
deletions to any Project Gutenberg™ work, and (c) any Defect
you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new
computers. It exists because of the efforts of hundreds of
volunteers and donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project
Gutenberg™’s goals and ensuring that the Project Gutenberg™
collection will remain freely available for generations to come. In
2001, the Project Gutenberg Literary Archive Foundation was
created to provide a secure and permanent future for Project
Gutenberg™ and future generations. To learn more about the
Project Gutenberg Literary Archive Foundation and how your
efforts and donations can help, see Sections 3 and 4 and the
Foundation information page at www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-
profit 501(c)(3) educational corporation organized under the
laws of the state of Mississippi and granted tax exempt status
by the Internal Revenue Service. The Foundation’s EIN or
federal tax identification number is 64-6221541. Contributions
to the Project Gutenberg Literary Archive Foundation are tax
deductible to the full extent permitted by U.S. federal laws and
your state’s laws.

The Foundation’s business office is located at 809 North 1500


West, Salt Lake City, UT 84116, (801) 596-1887. Email contact
links and up to date contact information can be found at the
Foundation’s website and official page at
www.gutenberg.org/contact
Section 4. Information about Donations to
the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission
of increasing the number of public domain and licensed works
that can be freely distributed in machine-readable form
accessible by the widest array of equipment including outdated
equipment. Many small donations ($1 to $5,000) are particularly
important to maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws


regulating charities and charitable donations in all 50 states of
the United States. Compliance requirements are not uniform
and it takes a considerable effort, much paperwork and many
fees to meet and keep up with these requirements. We do not
solicit donations in locations where we have not received written
confirmation of compliance. To SEND DONATIONS or determine
the status of compliance for any particular state visit
www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states


where we have not met the solicitation requirements, we know
of no prohibition against accepting unsolicited donations from
donors in such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot


make any statements concerning tax treatment of donations
received from outside the United States. U.S. laws alone swamp
our small staff.

Please check the Project Gutenberg web pages for current


donation methods and addresses. Donations are accepted in a
number of other ways including checks, online payments and
credit card donations. To donate, please visit:
www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could
be freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose
network of volunteer support.

Project Gutenberg™ eBooks are often created from several


printed editions, all of which are confirmed as not protected by
copyright in the U.S. unless a copyright notice is included. Thus,
we do not necessarily keep eBooks in compliance with any
particular paper edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg
Literary Archive Foundation, how to help produce our new
eBooks, and how to subscribe to our email newsletter to hear
about new eBooks.

You might also like