BPPCS103 203 Module1-Materials1
BPPCS103 203 Module1-Materials1
CONTENTS OF MODULE-1
• Definition of Computer
• Characteristics of Computers
• Generations of Computers
• Types/Application of Computer
• Applications of Computers
• Input and Output Devices
• Program Design Tools
• Introduction to C Programming
• Input and Output Functions
Introduction to Computer BPPCS103, Module-1
Chapter 1
Introduction to Computers
1.1 COMPUTER
A computer, in simple terms, can be defined as an electronic device that is designed to accept
data, perform the required mathematical and logical operations at high speed, and output the result.
We all have seen computers in our homes, schools, and colleges. In fact, in today’s scenario, we find
computers in most aspects of our daily lives. For some of us, it is hard to even imagine a world
without them.
In the past, computers were extremely large in size and often required an entire room for
installation. These computers consumed enormous amounts of power and were too expensive to be
used for commercial applications. Therefore, they were used only for limited tasks, such as
computing trajectories for astronomical or military applications. However, with technological
advancements, the size of computers became smaller and their energy requirements reduced
immensely. This opened the way for adoption of computers for commercial purposes.
Speed Computers can perform millions of operations per second, which means that data that
Introduction to Computer BPPCS103, Module-1
mayotherwise take many hours to process is output as information in the blink of an eye. The speed
of computers is usually given in nanoseconds and picoseconds, where 1 nanosecond = 1 × 10 −9
seconds and 1 picosecond = 1 × 10 −12 seconds.
Accuracy: A computer is a very fast, reliable, and robust electronic device. It always gives
accurate results, provided the correct data and set of instructions are input to it. Hence, in the event
of an error, it is the user who has fed the incorrect data/program is responsible. This clearly means
that the output generated by a computer depends on the given instructions and input data. If the
input data is wrong, then the output will also be erroneous. In computer
terminology, this is known as garbage-in, garbage-out (GIGO).
Automation: Besides being very fast and accurate, computers are automatable devices that
can perform a task without any user intervention. The user just needs to assign the task to the
computer, after which it automatically controls different devices attached to it and executes the
program instructions.
Diligence: Unlike humans, computers never get tired of a repetitive task. It can continually
work for hours without creating errors. Even if a large number of executions need
to be executed, each and every execution requires the same duration, and is executed with the same
accuracy.
Versatile: Versatility is the quality of being flexible. Today, computers are used in our daily
life in different fields. For example, they are used as personal computers (PCs) for home use, for
business- oriented tasks, weather forecasting, space exploration, teaching, railways, banking,
medicine, and so on, indicating that computers can perform different tasks simultaneously. On the
PC that you use at home, you may play a game, compose and send e-mails, listen to music, etc.
Therefore, computers are versatile devices as they can perform multiple tasks of different nature at
the same time.
Memory: Similar to humans, computers also have memory. Just the way we cannot store
everything in our memory and need secondary media, such as a notebook, to record certain
important things, computers also have internal or primary memory (storage space) as well as
external or secondary memory. While the internal memory of computers is very expensive and
limited in size, the secondary storage is cheaper and of bigger capacity.
The computer stores a large amount of data and programs in the secondary storage space.
The stored data and programs can be retrieved and used whenever required. Secondary memory is
the key fordata storage. Some examples of secondary devices include floppy disks, optical disks (CDs
and DVDs), hard disk drives (HDDs), and pen drives.
No IQ: Although the trend today is to make computers intelligent by inducing artificial
Introduction to Computer BPPCS103, Module-1
intelligence (AI) in them, they still do not have any decision-making abilities of their own. They need
guidance to perform various tasks.
Economical: Today, computers are considered as short term investments for achieving long-
term gains. Using computers also reduces manpower requirements and leads to an elegant and
efficient way of performing various tasks. Hence, computers save time, energy, and money. When
compared to other systems, computers can do more work in lesser time.
Highlights
• Computers were too bulky and required a complete room for storage
• Highly unreliable as vacuum tubes emitted a large amount of heat and burnt frequently
• Costly
• Difficult to use
• Required constant maintenance because vacuum tubes used fi laments that had limited life
time.Therefore, these computers were prone to frequent hardware failures
Hardware Technology Second generation computers were manufactured using transistors (see
Figure 1.4). Transistors were reliable, powerful, cheaper, smaller, and cooler than vacuum tubes.
Memory Magnetic core memory was used as primary memory; magnetic tapes and magnetic disks
were used to store data and instructions. These computers had faster and larger memory than the fi
rst generation computers.
Software Technology Programming was done in high level programming languages. Batch
operating system was used.
Used for Scientific and commercial applications
Examples Honeywell 400, IBM 7030, CDC 1604, UNIVAC LARC
Highlights
• Faster, smaller, cheaper, reliable, and easier to use than the first generation computers. They
consumed1/10th the power consumed by first generation computers
• Bulky in size and required a complete room for its installation
• Dissipated less heat than first generation computers but still required air-conditioned rooms
• Costly
• Difficult to use
Hardware Technology Third generation computers were manufactured using integrated chips
(ICs) (shown in Figure 1.5). ICs consist of several components such as transistors, capacitors, and
resistors ona single chip to avoid wired interconnections between components. These computers
used SSI and MSI technology. Minicomputers came into existence.
Note- Initially, ICs contained 10–20 components. This technology was called Small Scale Integration
(SSI). Later, it was enhanced to contain about 100 components. This was called MSI (Medium Scale
Integration).
Memory Larger magnetic core memory was used as primary memory; larger capacity magnetic
tapes and magnetic disks were used to store data and instructions.
Software Technology Programming was done in high level programming languages such as
FORTRAN, COBOL, Pascal, and BASIC. Time sharing operating system was used. Software was
separated from the hardware. This allowed users to invest only in the software they need.
Used for Scientific, commercial, and interactive online applications
Examples IBM 360/370, PDP-8, PADP-11, CDC6600
Highlights
• Faster, smaller, cheaper, reliable, and easier to use than the second generation computers
• Dissipated less heat than second generation computers but still required air-conditioned rooms
• Costly
Hardware Technology Fourth generation computers were manufactured using ICs with LSI (Large
Scale Integrated) and later with VLSI technology (Very Large Scale Integration). Microcomputers
came into existence. Use of personal computers became widespread. High speed computer networks
in the form of LANs, WANs, and MANs started growing. Besides mainframes, supercomputers were
also used.
Introduction to Computer BPPCS103, Module-1
Software Technology Programming was done in high level programming language such as C and
C++. Graphical User Interface (GUI) based operating system (e.g. Windows) was introduced. It had
icons and menus among other features to allow computers to be used as a general purpose machine
by all users. UNIX was also introduced as an open source operating system. Apple Mac OS and MS
DOS were also released during this period. All these operating systems had multi-processing and
multiprogramming capabilities.
Used for Scientific, commercial, interactive online, and network applications
Examples IBM PC, Apple II, TRS-80, VAX 9000, CRAY-1, CRAY-2, CRAY-X/MP
Used for Scientific, commercial, interactive online, multimedia (graphics, audio, video),
and network applications.
Examples IBM notebooks, Pentium PCs, SUM workstations, IBM SP/2, Param
supercomputer.
Highlights
• Faster, smaller, cheaper, powerful, reliable, and easier to use than the previous
generation computers
• Speed of microprocessors and the size of memory are growing rapidly.
• Supercomputers
• Mainframe computers
• Minicomputers
• Microcomputers
1.4.1 Supercomputers
Among the four categories, the supercomputer is the fastest, most powerful, and
most expensive computer. Supercomputers were first developed in the 1980s to process
large amounts of data and to solve complex scientific problems. Supercomputers use
parallel processing technology and can perform more than one trillion calculations in a
second.
1.4.2Mainframe Computers
Dumb Terminals
Dumb terminals consist of only a monitor and a keyboard (or mouse). They do not have
their own CPU and memory and use the mainframe system’s CPU and storage devices.
Intelligent Terminals
In contrast to dumb terminals, intelligent terminals have their own processor and thus
can perform some processing operations. However, just like the dumb terminals, they do
not have their own storage space. Usually, PCs are used as intelligent terminals to
facilitate data access and other services from the mainframe system.
Mainframe computers are typically used as servers on the World Wide Web. They
are also used in organizations such as banks, airline companies, and universities, where
a large number of users frequently access the data stored in their databases. IBM is the
major manufacturer of mainframe computers. Some examples of mainframe computers
include IBM S/390, Control Data CYBER 176, and Amdahl 580.
1.4.3Minicomputers
As the name suggests, minicomputers are smaller, cheaper, and slower than
mainframes. They are called minicomputers because they were the smallest computer of
their times. Also known as midrange computers, the capabilities of minicomputers fall
between mainframe and personal computers.
1.4.4Microcomputers
Microcomputers, commonly known as PCs, are very small and cheap. The first
microcomputer was designed by IBM in 1981 and was named IBM-PC. Later on, many
computer hardware companies copied this design and termed their microcomputers as
PC-compatible, which refers to any PC that is based on the original IBM PC design.
Another type of popular PC is designed by Apple. PCs designed by IBM and other PC-
compatible computers have a different architecture from that of Apple computers.
Moreover, PCs and PC-compatible computers commonly use the Windows operating
system, while Apple computers use the Macintosh operating system (MacOS). PCs can be
classified into the following categories:
Desktop PCs
A desktop PC is the most popular model of PCs. The system unit of the desktop PC
can be placedflat on a desk or table. It is widely used in homes and offices.
Introduction to C BPPCS103, Module-1
Laptops
Laptops (Figure 1.9) are small microcomputers that can easily fi t inside a
briefcase. They are very handy and can easily be carried from one place to another. They
may also be placed on the user’s lap (thus the name). Hence, laptops are very useful,
especially when going on long journeys. Laptops operate on a battery and do not always
have to be plugged in like desktop computers.
Workstations
Workstations are single-user computers that have the same features as PCs, but
their processing speed matches that of a minicomputer or mainframe computer.
Workstation computers have advanced processors, more RAM and storage capacity than
PCs. Therefore, they are more expensive and powerful than a normal desktop computer.
Network Computers
Network computers have less processing power, memory, and storage than a
desktop computer. These are specially designed to be used as terminals in a networked
environment. For example, some network computers are specifically designed to access
data stored on a network (including the Internet and intranet)
Handheld Computers
The mid-1990s witnessed a range of small personal computing devices that are
commonly knownas handheld computers, or mobile computers. These computers are
called handheld computers because they can fit in one hand, while users can use the
other hand to operate them.
Handheld computers are very small in size, and hence they have small-sized
screens and keyboards. These computers are preferred by business travellers and mobile
employees whose jobs require them to move from place to place. Some examples of
handheld computers are as follows:
Smartphones These days, cellular phones are web-enabled telephones. Such phones are
also known as smartphones because, in addition to basic phone capabilities, they also
facilitate the users to access the Internet and send e-mails, edit Word documents,
generate an Excel sheet, create a presentation, and lots more. Smartphones run an
advanced mobile operating system that enables it to run various applications. The four
Introduction to C BPPCS103, Module-1
major mobile operating systems are iOS, Android, BlackBerryOS, and Windows Mobile.
Smartphones also have a CPU, more storage space, more memory, and a larger screen
than a regular cell phone. In a nutshell, smartphone refers to a multi-functional mobile
phone handset that packs in varied functionalities from a camera to a web browser to a
high-density display.
Tablet PCs A tablet PC (see Figure 1.10) is a computing device that is smaller than a
laptop, but bigger than a smartphone. Features such as user-friendly interface,
portability, and touch screen have made them very popular in the last few years. These
days, a wide range of high-performance tablets are available in the market. While all of
them look similar from outside, they may differ in features such as operating system,
speed of data connectivity, camera specifications, size of the screen, processing power,
battery life, and storage capability.
messages in military applications. Later on, computers were used in real-time control
systems, like for landing on the moon. However, with the advancement of technology, the
cost of computers and their maintenance declined. This opened the way for computers
to be extensively used in the business and commercial sector for information processing.
Today, computers are widely used in fields such as engineering, health care, banking,
education, etc. Let us discuss how computers are being effectively utilized to perform
important tasks.
Word processing Word processing software enables users to read and write
documents. Users can also add images, tables, and graphs for illustrating a concept. The
software automatically corrects spelling mistakes and includes copy–paste features
(which is very useful where the same text has to be repeated several times).
Internet The Internet is a network of networks that connects computers all over the
world. It gives the user access to an enormous amount of information, much more than
available in any library. Using e- mail, the user can communicate in seconds with a person
who is located thousands of miles away. Chat software enables users to chat with another
person in real-time (irrespective of the physical location of that person). Video
Introduction to C BPPCS103, Module-1
conferencing tools are becoming popular for conducting meetings with people who are
unable to be present at a particular place.
Digital video or audio composition Computers make audio or video composition and
editing very simple. This has drastically reduced the cost of equipment to compose music
or make a fi lm. Graphics engineers use computers for developing short or full-length
films and creating 3-D models and special effects in science fiction and action movies.
Desktop publishing Desktop publishing software enables us to create page layouts for
entire books. After discussing how computers are used in today’s scenario, let us now
have a look at the different areas where computers are being widely utilized.
Health care Last few years have seen a massive growth of computers and smartphone
users. Like in our daily lives, computers have also become a necessary device in the
health care industry. The following are areas in which computers.
o Storing records To begin with, computers are first and foremost used to
store the medical records of patients. Earlier, patient records were kept
on paper, with separate records dealing with different medical issues from
separate healthcare organizations.
Multimedia and Animation Multimedia and animation that combine still images,
moving images, text, and sound in meaningful ways is one of most powerful aspects of
computer technology. We all have seen cartoon movies, which are nothing but an
example of computer animation.
Retail Business Computers are used in retail shops to enter orders, calculate costs, and
print receipts. They are also used to keep an inventory of the products available and their
complete description.
Sports In sports, computers are used to compile statistics, identify weak players and
strong players by analysing statistics, sell tickets, create training programs and diets for
athletes, and suggest game plan strategies based on the competitor’s past performance.
Computers are also used to generate most of the graphic art displays flashed on
scoreboards.
Travel and Tourism Computers are used to prepare tickets, monitor the train’s or
airplane’s route, and guide the plane to a safe landing. They are also used to research
about hotels in an area, reserve rooms, or to rent a car.
Simulation Supercomputers that can process enormous amount of data are widely used
in simulation tests. Simulation of automobile crashes or airplane emergency landings is
done to identify potential weaknesses in designs without risking human lives.
Astronomy Spacecraft’s are usually monitored using computers that not only keep a
continuous record of the voyage and of the speed, direction, fuel, and temperature, but
also suggest corrective action if the vehicle makes a mistake. The remote stations on the
earth compare all these quantities with the desired values, and in case these values need
to be modified to enhance the performance of the spacecraft, signals are immediately
sent that set in motion the mechanics to rectify the situation.
Education A computer is a powerful teaching aid and can act as another teacher in the
classroom. Teachers use computers to develop instructional material. Teachers may use
pictures, graphs, and graphical presentations to easily illustrate an otherwise difficult
concept. Moreover, teachers at all levels can use computers to administer assignments
and keep track of grades. Students can also give exams online and get instant results.
Introduction to C BPPCS103, Module-1
• Input: Algorithms take input data, which can be in various formats, such as numbers,
text, or images.
• Processing: The algorithm processes the input data through a series of logical and
mathematical operations, manipulating and transforming it as needed.
Introduction to C BPPCS103, Module-1
• Output: After the processing is complete, the algorithm produces an output, which
could be a result, a decision, or some other meaningful information.
1.7.2 FLOWCHARTS
A flowchart is a pictorial (graphical) representation of an algorithm. A flowchart is
drawn using different kinds of symbols. A symbol is used for a specific purpose. Each
symbol has name.
Flowcharts use different shapes of boxes to denote different type of instructions. ANSI
recommended a number of different rules and guidelines to help standardize the
flowcharting process.
▪ Algorithms are represented using flowcharts
▪ Flowchart symbols are standardized by ANSI
▪ Flowchart helps to divide a large complex problem into small manageable ones
▪ Generally, algorithm is first represented as a flowchart and then expressed in a
programming
language.
▪ While preparing a flowchart, the sequence, selection and iterative structures may be
used wherever
required.
Cache memory-Cache memory is faster than RAM because it's located closer to the
processor. This design allows the processor to quickly access frequently used data
and instructions.
ROM-Read-only memory (ROM) is nonvolatile and is used in the booting process of a
computer.
EEPROM-Electrically erasable programmable read-only memory (EEPROM) allows data
to be deleted and uploaded using an electric current
Introduction to C BPPCS103, Module-1
Chapter-2
Introduction to C
2.1 INTRODUCTION
The programming language C was developed in the early 1970s by Dennis Ritchie
at Bell Laboratories to be used by the UNIX operating system. It was named C' because
many of its features were derived from an earlier language called B'. Although C was
designed for implementing system software, it was later on widely used for developing
portable application software. C is one of the most popular programming languages. It
is being used on several different software platforms. In a nutshell, there are a few
computer architectures for which a C compiler does not exist. lt is a good idea to learn C
because few other programming languages such as C++ and Java are also based on C
which means you will be able to learn them more easily in the future.
2.1.1 Characteristics of C
C is a robust language whose rich set of built-in functions and operators can be
used to write complex programs. The C compiler combines the features of assembly
languages and high-level languages, which makes it best suited for writing system
software as well as business packages. Some basic characteristics of C language that
define the language andhave led to its popularity as a programming language are listed
below.
• C is a high-level programming language, which enables the programmer to
concentrate on the problem at hand and not worry about the machine code
on which the program would be run.
• Small size C has only 32 keywords. This makes it relatively easy to learn as
comparedto other languages.
• C makes extensive use of function calls.
• C is well suited for structured programming. In this programming approach, C
enablesusers to think of a problem in terms of functions/modules where the
collection of all the modules makes up a complete program. This feature
facilitates ease in program debugging, testing, and maintenance.
• Unlike PASCAL it supports loose typing (as a character can be treated as an integer
and vice versa).
• Structured language as the code can be organized as a collection of one or more
functions
2.1.2Uses of C
and Vala.
• Basically, C was designed as a programming language and was not meant to be
used as a compiler target language. Therefore, although C can be used as an
intermediate language it is not an ideal option.
• C is widely used to implement end-user applications.
at this function.
All functions (including main( ) ) are divided into two parts the declaration
sectionand the statement section. The declaration section precedes the statement section
and is used to describe the data that will be used in the function. Note that data declared
within a functionare known as local declaration as that data will be visible only within
that function. Stated in other terms, the life-time of the data will be only till the function
ends.
The statement section in a function contains the code that manipulates the data to
perform a specified task. From the structure given above we can conclude that a program
can have any number of functions depending On the tasks that have to be performed, and
each function can have any number of statements arranged according to specific
meaningfulsequence.
#include <stdio.h>
This is a pre-processor command that comes as the first statement in our code. All
pre-processor commands start with symbol hash (#). The #include statement tells the
compiler to include the standard input/output library or header file (stdio.h) in the
program.
int main ()
Introduction to C BPPCS103, Module-1
Every C program contains a main() function which is the starting point of the
program. Int is the return value of the main() function. After all the statements in the
programhave been written, the last statement of the program will return an integer value
to the operating system.
{ } The two curly brackets are used to group all the related statements of the main
function. All the statements between the braces form the function body. The function
body contains a set of instructions to perform the given task.
return 0;
This is a return command that is used to return the value 0 to the operating system
to give an indication that there were no errors during the execution of the program.
Source code lines which begin with the # symbol are actually not written in C but in the
pre- processor language. The output of the pre-processor is a text file which does not
contain any pre-processor statements. This file is ready to be processed by the compiler.
The linker combines the object file with library routines (supplied with the compiler)
to produce thefinal executable file.
Introduction to C BPPCS103, Module-1
In modular programming, the source code is divided into two or more source files.
All these source files are compiled separately thereby producing multiple object files.
These object files are combined by the linker to produce an executable file (Figure 2.5).
Many a time the meaning or the purpose of the file code is not clear to the
reader. Therefore it is a good programming practice to place some comments in the code
to help the reader understand the code clearly Comments are just a way of explaining
what a program does. It is merely an internal program documentation. The compiler
ignores the comments when forming the object file means that the comments are non-
executable statements.
2.7 C TOKENS
Tokens are the basic building blocks in C language. You may think of a token as the
smallest individual unit in a C program. This means that a program is constructed using
a combination of these tokens. There are six main types of tokens in C. They are shown in
Figure 2.6.
2.9 KEYWORDS
Like every computer language, C has a set of reserved words often known as keywords that
cannot be used as an identifier. All keywords are basically a sequence of characters that have a fixed
meaning. By convention al1 keywords must be written in lowercase (small) letters. Table 2.2 shows
the list of keywords in C.
2.9 IDENTIFIERS/VARIABLES
Identifiers, as the name suggests, help us to identify data and other objects in the program.
Identifiers are basically the names given to program elements such as variables, arrays, and
functions. Identifiers may consist of sequence of letters, numerals, or underscores.
Some rules have to be followed while forming identifier names. They are as follows:
• Identifiers cannot include any special characters or punctuation marks (like #,s, ^, ?, .,
etc.) except the underscore_.
• There cannot be two successive underscores.
• Keywords cannot be used as identifiers.
• The case of alphabetic characters that form the identifier name is significant.For
example, "FIRST' is different from 'first' and 'First'.
Table 9.4 shows the variants of basic data types. As can be seen from the table, we have
unsigned char and signed char. Do we have negative characters? No, then why do we have such data
types? The answer is that we use signed and unsigned char to ensure portability of programs that
store non-character data as char.
While the smaller data types take less memory, the larger types incur a performance penalty.
Although the data type we use for our variables does not have a big impact on the speed or memory
usage of the application, we should always try to use int unless there is a special need to use any
other data type.
Introduction to C BPPCS103, Module-1
2.11 VARIABLES
A variable is defined as a meaningful name given to a data storage location in computer
memory. When using a variable, we actually refer to address of the memory where the data is stored.
C language supports two basic kinds of variables numeric and character.
Each variable to be used in the program must be declared. To declare a variable, specify the
data type of the variable followed by its name. The data type indicates the kind of values that the
variable will store.
Variable names should always be meaningful and must reflect the purpose of their usage in
the program. The memory location of the variable is of importance to the compiler only and not to
the programmer. Programmers must only be concerned with accessing data through their symbolic
names. In C, variable declaration always ends with a semicolon, for example:
int emp_num;
float salary;
char grade;
double balance_amount; unsigned short int
acc_no;
2.12 CONSTANTS
Constants are identifiers whose values do not change. While values of variables can be
changed at any time, values of constants can never be changed. Constants are used to define fixed
values like mathematical constant pie or the charge on an electron so that their value does not get
changed in the program even by mistake.
A constant is an explicit data value specified by the programmer. The value of the constant is
known to the compiler at the compile time. C allows the programmer to specify constants of integer
type, floating point type, character type, and string type (Figure 2.8).
To declare a constant, precede the normal variable declaration with const keyword and
assign it a value. For example,
The const keyword specifies that the value of pi cannot change. However, another way to
designate a constant is to use the pre-processor command define. Like other pre- processor
commands, define is preceded with a # symbol. Although #define statements can be placed
anywhere in a C program, it is always recommended that these statements be placed at the beginning
of the program to make them easy to find and modify at a later stage. Look at the example given
below which defines the value of pi using define.
#define pi 3.14159
2.13.2 printf()
The printf function (stands for print formatting) is used to display information required by
the user and also prints the values of the variables. For this, the print function takes data values,
converts them to a text stream using formatting specifications in the controlstring and passes the
resulting text stream to the standard output. The control string may contain zero or more conversion
specifications, textual data, and control characters to be displayed.
The function accepts two parameters-control string and variable list. The control string may
also contain the text to be printed like instructions to the user, captions, identifiers,or any other text
to make the output readable.
Examples:
2.13.3 scanf()
The scanf() function stands for scan formatting and is used to read formatted data from the
keyboard. The scanf function takes a text stream from the keyboard, extracts and formats data from
the stream according to a format control string and then stores the data in specified program
variables. The syntax of the scanf() function can be given as:
The control string specifies the type and format of the data that has to be obtained from the
keyboard and stored in the memory locations pointed by arguments arg1, arg2,, argn, i.e., the
arguments are actually the variable addresses where each piece of data is to be stored.
Ex:
int num; scanf("%d", &num);
The scanf function reads an integer value (because the type specifier is %d) into the
address or the memory location pointed by num.
The scanf function reads a floating point number (because the type specifier is %f) into the
address or the memory location pointed by salary.
The scanf function reads a single character (because the type specifier is %c) into the address
or the memory location pointed by ch.
The scanf function reads a string or a sequence of characters (because the typespecifier is %s)
into the address or the memory location pointed by str. Note that in case of reading strings, we do
not use the & sign in the scanf function.
Example program:
Write a program to demonstrate the use of printf and scanf statements to read and printvalues
Introduction to C BPPCS103, Module-1
of variables of different data types.
scanf("%c", &code);
printf("\n Enter the message :");scanf("%s",
msg);
printf("\n NUM = %d \n AMT = %f \n PI %e \n POPULATION OF INDIA = %1d \nCODE = %c \n
MESSAGE = %s", num, amt, pi, population_of_india, code, msg); return 0;
}
OUTPUT:
NUM = 5
AMT = 123.450000PI = 3.141590e+00
POPULATION OF INDIA = 12345CODE = c
MESSAGE = Hello