This document provides an overview of pseudocode practice problems and examples with solutions. It includes explanations of the main components of pseudocode including variables, assignment, input/output, selection, and repetition. Six examples of pseudocode problems are given with step-by-step solutions. Two homework problems are also provided with multiple solutions for writing pseudocode to sort three numbers and calculate a running sum by adding user-entered numbers until a negative number is entered.
A string is a data type used in programming, such as an integer and floating point unit, but is used to represent text rather than numbers. It is comprised of a set of characters that can also contain spaces and numbers. For example, the word "hamburger" and the phrase "I ate 3 hamburgers" are both strings.
A string is a data type used in programming, such as an integer and floating point unit, but is used to represent text rather than numbers. It is comprised of a set of characters that can also contain spaces and numbers. For example, the word "hamburger" and the phrase "I ate 3 hamburgers" are both strings.
YouTube Link: https://youtu.be/mHezNgNBnuA
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on 'Date and Time in Python' will train you to use the datetime and time modules to fetch, set and modify date and time in python.
Below are the topics covered in this PPT:
The time module
Built-in functions
Examples
The datetime module
Built-in functions
Examples
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
2D array in C++ language ,define the concept of c++ Two-Dimensional array .with example .and also Accessing Array Components concept.and Processing Two-Dimensional Arrays.
Change management for leaders to achieve business competitiveRidwan Ibrahim
Tight business competition, technological developments, the financial crisis and the changing times, resulting in companies experiencing difficulties to develop.
The main factors that led to these difficulties, the unpreparedness of the organization to define and align business strategy which is aligned and must be executed.
YouTube Link: https://youtu.be/mHezNgNBnuA
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on 'Date and Time in Python' will train you to use the datetime and time modules to fetch, set and modify date and time in python.
Below are the topics covered in this PPT:
The time module
Built-in functions
Examples
The datetime module
Built-in functions
Examples
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
2D array in C++ language ,define the concept of c++ Two-Dimensional array .with example .and also Accessing Array Components concept.and Processing Two-Dimensional Arrays.
Change management for leaders to achieve business competitiveRidwan Ibrahim
Tight business competition, technological developments, the financial crisis and the changing times, resulting in companies experiencing difficulties to develop.
The main factors that led to these difficulties, the unpreparedness of the organization to define and align business strategy which is aligned and must be executed.
Problems are always facing the organization (company) when applying the "Change Management" is rejection (resistance) which is carried out by members of an organization, individual or group, so that the process of change is congested, so the decision to make frequent changes to meet or fail.
In the face or overcome resistance carried out by members of the organization, the strategy is often done is provide understanding in depth about the function and purpose of change, through the communications made by the Agent of Change Management to members organisasai who reject the change, do not give results and even rejection bigger or stronger occurs.
Implementation Strategy for Research and Community Service of UniversityRidwan Ibrahim
Empowering the Research and Community Service of University, in creating a sustainable business by utilizing the faculty, staff, students and community, has the benefits of creating skilled manpower.
Money laundering (Money Laundering) occurs because law enforcement does not detect financial transactions conducted by money launderers (Money launders) at the time of the activity of financial transactions made in cash, bank transfer (transactions between banks in the country with a bank abroad) , including the use of financial instruments, as defined in the legislation.
Law enforcement, has not been able to work optimally, in the fight against money laundering and catch the culprit
Google Terjemahan untuk Bisnis:Perangkat Penerjemah
Alignment HRBP with ISO 41000-2015 to Achieve Business on GlobalizationRidwan Ibrahim
By going to the enactment uniformly around the world on international standardization ISO 41000: 2015 - Facility Management, the Human Resources Business Partners (HRBP) are popular in today's organizations, become irrelevant, due in concept HRBP, yet the inclusion of a condition on the capability requirements for sustainable business growth, as implied in the ISO 41000: 2015.
One of the provisions of international standardization within the ISO 41000: 2015, in the form of competence in HRBP to ensure business growth on an ongoing basis, not implicit and explicit in the role, duties and responsibilities as HRBP, so that businesses run by function HRBP inadequate in providing certainty of sustainable growth
Somos a Jimbo (www.jimbo.com.br), um site de entrevistas de emprego para empresas que procuram recrutar o candidato ideal economizando tempo, dinheiro e processos repetitivos.
Nosso diferencial é que as entrevistas são feita através de mensagens de vídeo, onde a empresa escreve a pergunta e o candidato responde com uma mensagem de vídeo, se enquadrando no tempo que a empresa definiu para cada resposta.
Change management towards sustainable business growth (aligned with ISO 41000...Ridwan Ibrahim
The problems still faced by the company (organization) who has run / change management, is yet to be felt sustainable business growth, due to the orientation of the action to make changes focused on one type of problems encountered, or the strategic objectives of the company (organization) that integrated yet to be achieved.
The primary cause of these problems is not its organizational competency standards as required under the international standard (ISO 41000: 2015) in the form of facility management, so that the intent and purpose of the application of change management for the organization is not incorporated (integrated)
We have single, double & common rooms with separate bathroom.
Deluxe Rooms(Partial Mountain View) Sharing Room
– In sharing two rooms is one Double bed and Twin bed can stay four people and more… rooms neat & bright rooms with, hot & cold shower & luxuries bed. LCD TV (Local & International Channels).
Super Deluxe Rooms(Clear Mountain) Single Room
– In a single room with twin’s bed can stay two person rooms neat & bright rooms with, hot & cold shower & luxuries bed.
Deluxe Suites (Clear Two Side Mountain) Double Room
– In a double bed can stay two person rooms with neat & bright rooms with, hot & cold shower & luxuries bed.
Nirvana yoga conduct all type, all style of yoga Please drop one time in Nirvana yoga Studio…
Courses:- Hatha yoga, Beginner Asthang yoga, Hatha Vinyasa yoga, Power yoga, Bikrm yoga in normal yoga hall sihvananda yoga, Pranayama, Yogic kerya, Meditation We have also teach six day six different style yoga.
Talent Developing Strategy For Human Capital To Achieve ROIRidwan Ibrahim
The need for organizations to talented employees to be placed in the right position, the first step to achieving organizational success according to the targets set, but in determining talented employees, the organization made a mistake at the beginning of the assessment because it is not done objectively.
The next mistake is made when implementing development programs, inclusion is not planning to return on investment from the resulting performance, after following the program, so that the development of talent becomes aligned with the goal of Human Capital.
OverviewThis hands-on lab allows you to follow and experiment w.docxgerardkortney
Overview:
This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description, Analysis, , Design(program design, pseudocode), Test Plan, and implementation with C code. The example provided uses sequential, repetition statements and nested repetition statements.
Program Description:
This program will calculate the average of 10 positive integers. The program will ask the user to 10 integers. If any of the values entered is negative, a message will be displayed asking the user to enter a value greater than 0. The program will use a loop to input the data.
Analysis:
I will use sequential, selection and repetition programming statements.
The program will loop for 10 positive numbers, prompting the user to enter a number.
I will define three integer variables: count, value and sum. count will store how many times values greater than 0 are entered. value will store the input. Sum will store the sum of all 10 integers.
I will define one double number: avg. avg will store the average of the ten positive integers input.
The sum will be calculated by this formula: sum = sum + value For example, if the first value entered was 4 and second was 10: sum = sum + value = 0 + 4
sum = 4 + 10 = 14
Values and sum can be input and calculated within a repetition loop: while count <10
Input value
sum = sum + value End while
Avg can be calculated by: avg = value/count
A selection statement can be used inside the loop to make sure the input value is positive.
If value >= 0 then count = count + 1 sum = sum + value
Else
input value End If
(
7
)
Program Design:
Main
// This program will calculate the average of 10 integer numbers
// Declare variables
// Initialize variables
// Loop through 10 numbers
// Prompt for positive integer
// Get input
// test input value for gt 0 if (value > 0)
//Increment counter
//Accumulate sum Else
// display msg to enter a positive integer
// Prompt for positive integer
// Get input Endif
// End loop
//Calculate average
//Print the results (average)
End
Test Plan:
To verify this program is working properly the input values could be used for testing:
Test Case
Input
Expected Output
1
1 1 1 0 1
2 0 1 3 2
Average = 1.2
2
100 100 100 100 -100
Input a positive value
100 200 -200 200 200
Input a positive value
200 200
average is 120.0
NOTE: test #2 has 12 input numbers because there are two negative numbers.
Pseudocode: Main
// This program will calculate the average of 10 positive integers.
// Declare variables
Declare count, value, sum as Integer Declare avg as double
//Initialize values
Set count=0 Set sum = 0 Set avg = 0.0;
// Loop through 10 integers While count < 10
Input value
If (value >=0)
sum = sum + value count=count+1
Else
Pr *** Value must be positive *** Input value
End if End While
// Calculate average avg = sum/count
// Print results
End //End of Main
C Code
The following is the C Code that will compile in execute in the online.
1 ECE 175 Computer Programming for Engineering Applica.docxoswald1horne84988
1
ECE 175: Computer Programming for Engineering Applications
Homework Assignment 6
Due: Tuesday March 12, 2019 by 11.59 pm
Conventions: Name your C programs as hwxpy.c where x corresponds to the homework number and y
corresponds to the problem number. For example, the C program for homework 6, problem 1 should be
named as hw6p1.c.
Write comments to your programs. Programs with no comments will receive PARTIAL credit. For each
program that you turn in, at least the following information should be included at the top of the C file:
- Author and Date created
- Brief description of the program:
- input(s) and output(s)
- brief description or relationship between inputs and outputs
Submission Instructions: Use the designated Dropbox on D2L to submit your homework.
Submit only the .c files.
Problem 1 (15 points) Write a program that returns the minimum value and its location, max
value and its location and average value of an array of integers. Your program should call a
single function that returns that min and its location, max and its location and mean value of
the array. Print the results in the main function (not within the array_func function).
See sample code execution below. The declaration of this function is given below:
void array_func (int *x, int size, int *min_p, int *minloc_p, int *max_p, int *maxloc_p, double *mean_p)
/* x is a pointer to the first array element
size is the array size
min_p is a pointer to a variable min in the main function that holds the minimum
minloc_p is a pointer to a variable minloc in the main function that holds the location where the
minimum is.
max_p is a pointer to a variable max in the main function that holds the maximum
maxloc_p is a pointer to a variable maxloc in the main function that holds the location where the
maximum is.
mean_p is a pointer to a variable mean in the main function that holds the mean */
Declare the following array of integers within the main function:
Sample code execution:
int data_ar[] = { -3, 5, 6, 7, 12, 3, 4, 6, 19, 23, 100, 3, 4, -2, 9, 43, 32, 45,
32, 2, 3, 2, -1, 8 };
int data_ar2[] = { -679,-758,-744,-393,-656,-172,-707,-32,-277,-47,-98,-824,-695,
-318,-951,-35,-439,-382,-766,-796,-187,-490,-446,-647};
int data_ar3[] = {-142, -2, -56, -60, 114, -249, 45, -139, -25, 17, 75, -27, 158,
-48, 33, 67, 9, 89, 33, -78, -180, 186, 218, -274};
2
Problem 2 (20 points): A barcode scanner verifies the 12-digit code scanned by comparing the
code’s last digit to its own computation of the check digit calculated from the first 11 digits as
follows:
1. Calculate the sum of the digits in the odd-numbered indices (the first, third, …, ninth
digits) and multiply this sum by 3.
2. Calculate the sum of the digits in the even-numbered indices (the 0th, second, … tenth
digits).
3. Add the results from step 1 and 2. If the last digit of the addition result is 0, then 0 is the
check digit. .
In this PPT you will learn how to use looping in python.
For more presentation in any subject please contact us on
raginijain0208@gmail.com.
You get a new presentation every Sunday at 10 AM.
Learn more about Python by clicking on given below link
Python Introduction- https://www.slideshare.net/RaginiJain21/final-presentation-on-python
Basic concept of Python -https://www.slideshare.net/RaginiJain21/python-second-ppt
Python Datatypes - https://www.slideshare.net/RaginiJain21/data-types-in-python-248466302
Python Library & Module - https://www.slideshare.net/RaginiJain21/python-libraries-and-modules
Basic Python Programs- https://www.slideshare.net/RaginiJain21/basic-python-programs
Python Media Libarary - https://www.slideshare.net/RaginiJain21/python-media-library
learn how to program with python
from scratch to be an expert
use the link in the first slide to get the full course
here is the link if you want : https://oke.io/JdxdUl
the link of the documentation : https://oke.io/J6DeY3
link to download python : https://oke.io/BENgRLR2
1. Pseudo Code Practice Problems:
Listedbelowisabrief explanationof Pseudocode aswell asalistof examplesandsolutions.
Pseudo code
Pseudocode can be brokendownintofive components.
• Variables:
• Assignment:
• Input/output:
• Selection:
• Repetition:
A variable has a name, a data type, and a value. There is a location in memory associated with each
variable. A variable can be called anything or be given any name. It is considered good practice to use
variable namesthatare relevanttothe task at hand.
Assignmentisthe physical actof placinga value intoavariable.Assignmentcanbe shownusing
set= 5;
set= num+ set;
The left side is the variable a value is being stored in and the right side is where the variable is being
accessed. When a variable is assigned a value, the old value is written over with the new value so the old
value is gone. x = 5 does not mean that x is equal to 5; it means set the variable x to have the value 5.
Give x the value 5, make x equal to 5.
Input / Output both deal with an outside source (can be a user or another program) receiving or giving
information. An example would be assuming a fast food restaurant is a program. A driver (user) would
submit their order for a burger and fries (input), they would then drive to the side window and pick up
theirorderedmeal (output.)
• Output– Write / display/print
• Input– Read/ get/ input
Selection construct allows for a choice between performing an action and skipping it. It is our
conditional statements.Selectionstatementsare writtenassuch:
if ( conditional statement)
statementlist
else
statementlist
Repetitionisa construct that allowsinstructionstobe executedmultipletimes(IErepeated).
In a repetitionproblem
• Countis initialized
• Tested
• incremented
Repetitionproblemsare shownas:
while ( conditionstatement)
2. statementlist
Examples
Example 1: Write pseudocode that reads two numbersand multipliesthemtogether andprintout
theirproduct.
Example 2: Write pseudocode thattells a userthat the numberthey enteredisnot a 5 or a 6.
Example 3: Write pseudocode thatperformsthe following:Askauserto entera number. If the number
is between0 and 10, write the word blue.Ifthe numberis between10 and 20, write the word
red. ifthe numberis between20 and 30, write the word green. If it isany othernumber,write
that itis not a correct coloroption.
Example 4: Write pseudocode to print all multiplesof5 between1 and 100 (includingboth1 and100).
Example 5: Write pseudocode thatwill countall the evennumbersup to a userdefinedstopping
point.
Example 6: Write pseudocode thatwill performthe following.
a) Readin 5 separate numbers.
b) Calculate the average of the five numbers.
c) Findthe smallest(minimum) andlargest(maximum)of the five enterednumbers.
d) Write outthe resultsfoundfromstepsband c witha message describingwhattheyare
Homework1: Write pseudocode thatreads inthree numbersandwritesthemall insortedorder.
Homework2: Write pseudocode thatwill calculate arunningsum.A userwill enternumbersthatwill
be addedto the sum and whenanegative numberisencountered,stopaddingnumbersand
write outthe final result.
Solutions
Example 1: Write pseudocode thatreadstwo numbersandmultipliesthemtogetherandprintout their
product.
Pseudocode
Readnum1 , num2
Setmulti to num1*num2
Write multi
Ch code
intnum1, num2,multi;
cin>>num1>>num2;
multi = num1 * num2;
cout<<multi<<endl;
Example 2: Write pseudocode thattellsauser that the numbertheyenteredisnota5 or a 6.
Example 2 Solution1:
PseudoCode: CH code:
3. Readisfive
If(isfive =5)
Write "your numberis5"
Else if (isfive =6)
Write "your numberis6"
Else
Write "your numberisnot5 or 6"
intisfive;
cin>> isfive;
if(isfive==5)
{ cout<<"yournumberis5"; }
else if(isfive ==6)
{ cout<<"yournumberis6"; }
else
{ cout<<"yournumberisnot 5 or 6"; }
Example 2 Solution2:
PseudoCode:
Readisfive
If(isfive =5 or isfive =6)
Write "your numberisa 5 or 6"
Else
Write "your numberisnot5 or 6"
CH code:
intisfive;
cin>> isfive;
if(isfive==5 || isfive ==6)
{ cout<<"yournumberis5 or 6"; }
else
{ cout<<"yournumberisnot 5 or 6"; }
Example 2 Solution3:
PseudoCode:
Readisfive
If(isfive isnot5 andisfive isnot6)
Write "your numberisnot5 or 6"
CH code:
intisfive;
cin>> isfive;
if(isfive!=5 && isfive !=6)
{ cout<<"yournumberisnot 5 or 6"; }
Example 3: Write pseudocode thatperformsthe following:Askauserto entera number.If the number
isbetween0and 10, write the wordblue.If the numberisbetween10and 20, write the word
red.if the numberisbetween20and 30, write the word green.If itisany othernumber,write
that itis not a correct coloroption.
PseudoCode:
Write "Please enteranumber"
Readcolornum
If (colornum>0 andcolornum<= 10)
Write blue
else If (colornum>0 andcolornum<= 10)
Write blue
else If (colornum>0 andcolornum<= 10)
Write blue
else
Write "not a correct color option"
CH code:
intcolornum;
cout<<"Please enteranumber"
cin>> colornum;
if(colornum>0 && colornum<= 10)
{ cout<<"blue"; }
else if(colornum>0 && colornum<= 10)
{ cout<<"blue";}
else if(colornum>0 && colornum<= 10)
{ cout<<"blue"; }
else
{ cout<<"not a correct coloroption" }
4. Example 4: Write pseudocode toprintall multiplesof 5between1and 100 (includingboth1and 100).
PseudoCode:
Setx to 1
While(x <20)
write x
x = x*5
CH code:
intx = 1;
cin>>x;
while(x<20)
{ cout<<x;
x = x*5;
}
Example 5: Write pseudocode thatwill countall the evennumbersuptoa userdefinedstoppingpoint.
For example,saywe wanttosee the first5 evennumbersstartingfrom0.
well,we knowthatevensnumbersare 0,2, 4, etc.
The first5 evennumbersare 0, 2, 4, 6, 8.
The first8 evennumbersare 0, 2, 4, 6, 8 ,10 ,12, 16
Example 5 solution1:
PseudoCode:
Readcount
Setx to 0;
While(x <count)
Set eventoeven+ 2
x = x + 1
write even
CH code:
intx, count,even;
x = 0;
even= 0;
cin>>count;
while(x<count)
{ cout<<even;
even= even+2;
x = x+1;
}
Example 5 solution2:
PseudoCode:
Readcount
Setx to 0;
While(x <count)
Set eventoeven+ 2
x = x + 1
write even
CH code:
intx, count,even;
cout<<"0";
x = 1;
cin>>count;
while(x<count)
{ cout<<x*2;
x = x+1;
}
5. Example 6: Write pseudocode thatwill performthe following.
a) Readin 5 separate numbers.
b) Calculate the average of the five numbers.
c) Findthe smallest(minimum) andlargest(maximum)of the five enterednumbers.
d) Write outthe resultsfoundfromstepsband c witha message describingwhattheyare.
PseudoCode:
Write "please enter5numbers"
Readn1,n2,n3,n4,n5
Write "The average is"
Setavg to (n1+n2+n3+n4+n5)/5
Write avg
If(n1< n2)
Setmax to n2
Else
Setmax to n1
If(n3> max)
Setmax to n3
If(n4> max)
Setmax to n4
If(n5> max)
Setmax to n5
Write "The max is"
Write max
If(n1> n2)
Setminto n2
Else
Setminto n1
If(n3< min)
Setminto n3
If(n4< min)
Setminto n4
If(n5< min)
Setminto n5
Write "The min is"
Write min
CH code:
cout<<"please enter5numbers";
intn1,n2,n3,n4,n5;
cin>>n1>>n2>>n3>>n4>>n5;
intavg = (n1+n2+n3+n4+n5)/5;
cout<<"The average is"<<avg;
intmin,max;
if(n1<n2)
max=n2;
else
max=n1;
if(n3>max)
max=n3;
if(n4>max)
max=n4;
if(n5>max)
max=n5;
cout<<"The max is"<<max;
if(n1>n2)
min=n2;
else
min=n1;
if(n3<min)
min=n3;
if(n4<min)
min=n4;
if(n5<min)
min=n5;
cout<<"The minis"<<min;
Homework1: Write pseudocode thatreads inthree numbersandwritesthemall insortedorder.
7. Homework2: Write pseudocode thatwill calculate arunningsum.A userwill enternumbersthatwill
be addedto the sum and whenanegative numberisencountered,stopaddingnumbersand
write outthe final result.
Pseudo Code:
Readx
Setsum to 0;
While(x >=0)
Set sumto x + sum
Read x
CH code:
intx, sum;
sum= 0;
cin>>x;
while(x>=0)
{ sum = sum + x
cin>>x;
}
C - Basic Introduction
The C is a general-purpose, procedural, imperative computer programming language
developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating
system.
C is the most widely used computer language.
C is a general-purpose high level language that was originally developed by Dennis Ritchie for
the Unix operating system. It was first implemented on the Digital Eqquipment Corporation
PDP-11 computer in 1972.
The Unix operating system and virtually all Unix applications are written in the C language. C
has now become a widely used professional language for various reasons.
• Easy to learn
• Structured language
• It produces efficient programs.
• It can handle low-level activities.
• It can be compiled on a variety of computers.
Facts about C
• C was invented to write an operating system called UNIX.
• C is a successor of B language which was introduced around 1970
• The language was formalized in 1988 by the American National Standard Institue
(ANSI).
• By 1973 UNIX OS almost totally written in C.
• Today C is the most widely used System Programming Language.
• Most of the state of the art software have been implemented using C
8. Why to use C ?
C was initially used for system development work, in particular the programs that make-up the
operating system. C was adoped as a system development language because it produces code that
runs nearly as fast as code written in assembly language. Some examples of the use of C might
be:
• Operating Systems
• Language Compilers
• Assemblers
• Text Editors
• Print Spoolers
• Network Drivers
• Modern Programs
• Data Bases
• Language Interpreters
• Utilities
C Program File
All the C programs are writen into text files with extension ".c" for example hello.c. You can use
"vi" editor to write your C program into a file.
This tutorial assumes that you know how to edit a text file and how to write programming
insturctions inside a program file.
C Compilers
When you write any program in C language then to run that program you need to compile that
program using a C Compiler which converts your program into a language understandable by a
computer. This is called machine language (ie. binary format). So before proceeding, make sure
you have C Compiler available at your computer. It comes alongwith all flavors of Unix and
Linux.
If you are working over Unix or Linux then you can type gcc -v or cc -v and check the result.
You can ask your system administrator or you can take help from anyone to identify an available
C Compiler at your computer.
If you don't have C compiler installed at your computer then you can use below given link to
download a GNU C Compiler and use it.
To know more about compilation you can go through this small tutorial Learn HYPERLINK
"http://www.tutorialspoint.com/makefile/index.htm"Makefile.
A C programbasically has the following form:
• P reprocessor Commands
• Functions
• V ariables
9. • Statements & Expressions
• C omments
The following program is written in the C programming language. Open a text file hello.c using vi editor and put the following lines inside
that file.
#include <stdio.h>
int main()
{
/* My first program */
printf("Hello, World! n");
return 0;
}
Preprocessor Commands: T hese commands tells the compiler to do preprocessing before doing actual compilation. Like #include
<stdio.h> is a preprocessor command which tells a C compiler to include stdio.h file before going to actual compilation. You will learn more
about C Preprocessors in C Preprocessors session.
Functions: are main building blocks of any C Program. Every C Program will have one or more functions and there is one mandatory function
which is called main() function. This function is prefixed with keyword int which means this function returns an integer value when it exits.
T his integer value is retured using return statement.
The C Programming language provides a set of built-in functions. In the above example printf()is a C built-in function which is used to print
anything on the screen. Check Builtin functionsection for more detail.
Y ou will learnhow to write yourown functions and use them in Using Function session.
Variables: are used to hold numbers, strings and complex data for manipulation. Y ou will learn in detail about variables in C Variable Types.
Statements & Expressions : Expressions combine variables and constants to create new values . Statements are expressions, assignments,
functioncalls, or control flow statements whichmake up C programs.
Comments: are used to give additional useful information inside a C Program. All the comments will be put inside /*...*/ as given in the
example above. A comment canspan throughmultiple lines.
Note the followings
• C is a case sensitive programming language. It means in C printf and Printf will have different meanings.
• C has a free-formline structure. End of eachC statement must be marked with a semicolon.
• M ultiple statements can be one the same line.
• White Spaces (ie tab space and space bar ) are ignored.
• Statements cancontinue over multiple lines.
C Program Compilation
To compile a C program you would have to Compiler name and program files name. Assuming your compiler's name is cc and progra m file
name is hello.c, give following command at U nix prompt.
$cc hello.c
This will produce a binary file called a.out and an object file hello.o in your current directory. Here a.out is your first program which you will
run at Unix prompt like any other system program. If you don't like the name a.out then you can produce a binary file with your own name by
using -o option while compiling C program. See an example below
$cc -o hello hello.c
Now you will get a binary with name hello. Execute this program at Unix prompt but before executing / running this program make sure that
it has execute permissionset. If youdon't know what is execute permissionthen just follow these two steps
$chmod 755 hello
$./hello
This will produce following result
Hello, World
C ongratulations!! youhave writtenyour first programin "C". Now believe me its not difficult to learn "C".