SlideShare a Scribd company logo
Programming Basics
Version_Sep_2013
C
SharpC
ode.org
Program..
Sequence of instructions written for specific purpose
Like program to find out factorial of number
Can be written in higher level programming languages that
human can understandhuman can understand
Those programs are translated to computer understandable
languages
Task will be done by special tool called compiler
Version_Sep_2013
C
SharpC
ode.org
Compiler will convert higher level language code to lower
language code like binary code
Most prior programming language was ‘C’
Rules & format that should be followed while writingRules & format that should be followed while writing
program are called syntax
Consider program to print “Hello!” on screen
Version_Sep_2013
C
SharpC
ode.org
void main()
{
printf(“Hello!”);
}}
Void main(), function and entry point of compilation
Part within two curly brackets, is body of function
Printf(), function to print sequence of characters on screen
Version_Sep_2013
C
SharpC
ode.org
Any programming language having three part
1. Data types
2. Keywords
3. Operators3. Operators
Data types are like int, float, double
Keyword are like printf, main, if, else
The words that are pre-defined for compiler are keyword
Keywords can not be used to define variable
Version_Sep_2013
C
SharpC
ode.org
We can define variable of data type
Like int a; then ‘a’ will hold value of type int and is called
variable
Programs can have different type of statements likePrograms can have different type of statements like
conditional statements and looping statements
Conditional statements are for checking some condition
Version_Sep_2013
C
SharpC
ode.org
Conditional Statements…
Conditional statements controls the sequence of
statements, depending on the condition
Relational operators allow comparing two values.
1. == is equal to1. == is equal to
2. != not equal to
3. < less than
4. > greater than
5. <= less than or equal to
6. >= greater than or equal to
Version_Sep_2013
C
SharpC
ode.org
SIMPLE IF STATEMENT
It execute if condition is TRUE
Syntax:
if(condition)
{{
Statement1;
.....
Statement n;
}
Version_Sep_2013
C
SharpC
ode.org
main()
{
int a,b;
printf(“Enter a,b values:”);
scanf(“%d %d”,&a,&b);
if(a>b) {
printf(“n a is greater than b”); }printf(“n a is greater than b”); }
}
OUTPUT:
Enter a,b values:20 10
a is greater than b
Version_Sep_2013
C
SharpC
ode.org
IF-ELSE STATEMENT
It execute IF condition is TRUE.IF condition is FLASE it execute ELSE part
Syntax:
if(condition)
{
Statement1;Statement1;
.....
Statement n;
}
else
{
Statement1;
.....
Statement n;
}
Version_Sep_2013
C
SharpC
ode.org
main()
{
int a,b;
printf(“Enter a,b values:”);
scanf(“%d %d”,&a,&b);
if(a>b) {
printf(“n a is greater than b”); }
else {else {
printf(“nb is greater than b”); }
}
OUTPUT:
Enter a,b values:10 20
b is greater than a
Version_Sep_2013
C
SharpC
ode.org
IF-ELSE IF STATEMENT:
It execute IF condition is TRUE.IF condition is FLASE it checks ELSE IF part
.ELSE IF is true then execute ELSE IF PART. This is also false it goes to ELSE
part.
Syntax:
if(condition)
{
Statementn;Statementn;
}
else if(condition)
{
Statementn;
}
else
{
Statement n;
}
Version_Sep_2013
C
SharpC
ode.org
main()
{
int a,b;
printf(“Enter a,b values:”);
scanf(“%d %d”,&a,&b);
if(a>b) {
printf(“n a is greater than b”); }
else if(b>a) {else if(b>a) {
printf(“nb is greater than b”); }
else {
printf(“n a is equal to b”); }
}
OUTPUT:
Enter a,b values:10 10
a is equal to b
Version_Sep_2013
C
SharpC
ode.org
NESTED IF STATEMENT
To check one conditoin within another.
Take care of brace brackets within the conditions.
Synatax:
if(condition)
{{
if(condition)
{
Statement n;
}
}
else
{
Statement n;
}
Version_Sep_2013
C
SharpC
ode.org
main()
{
int a,b;
printf(“n Enter a and b values:”);
scanf(“%d %d ”,&a,&b);
if(a>b) {
if((a!=0) && (b!=0)) {
printf(“na and b both are +ve and a >b); }
else {else {
printf(“n a is greater than b only”) ; } }
else {
printf(“ na is less than b”); }
}
Output:
Enter a and b values:30 20
a and b both are +ve and a > b
Version_Sep_2013
C
SharpC
ode.org
Switch..case
The switch statement is much like a nested if .. else statement.
switch statement can be slightly more efficient and easier to read.
Syntax :
switch( expression )
{
case constant-expression1:case constant-expression1:
statements1; break;
case constant-expression2:
statements2; break
default :
statements4; break;
}
Version_Sep_2013
C
SharpC
ode.org
main()
{
char Grade = ‘B’;
switch( Grade )
{
case 'A' :
printf( "Excellentn" ); break;
case 'B' :
printf( "Goodn" ); break;
case 'C' :case 'C' :
printf( "OKn" ); break;
case 'D' :
printf( "Mmmmm....n" ); break;
default :
printf( "What is your grade anyway?" );
break;
}
}
Version_Sep_2013
C
SharpC
ode.org
Looping…
Loops provide a way to repeat commands and control how many
times they are repeated.
C provides a number of looping way.
while loopwhile loop
A while statement is like a repeating if statement.
Like an If statement, if the test condition is true: the statements
get executed.
The difference is that after the statements have been executed,
the test condition is checked again.
If it is still true the statements get executed again.
This cycle repeats until the test condition evaluates to false.
Version_Sep_2013
C
SharpC
ode.org
Basic syntax of while loop is as follows:
while ( expression )
{
Single statement or Block of statements;Single statement or Block of statements;
}
Will check for expression, until its true when it gets false
execution will be stop
Version_Sep_2013
C
SharpC
ode.org
main()
{
int i = 5;
while ( i > 0 ) {
printf("Hello %dn", i );
i = i -1; }
}}
Output
Hello 5
Hello 4
Hello 3
Hello 2
Hello 1
Version_Sep_2013
C
SharpC
ode.org
Do..While
do ... while is just like a while loop except that the test
condition is checked at the end of the loop rather than the
start.
This has the effect that the content of the loop are alwaysThis has the effect that the content of the loop are always
executed at least once.
Basic syntax of do...while loop is as follows:
do {
Single statement or Block of statements; }
while(expression);
Version_Sep_2013
C
SharpC
ode.org
main()
{
int i = 5;
do{
printf("Hello %dn", i );
i = i -1; }
while ( i > 0 );
}}
Output
Hello 5
Hello 4
Hello 3
Hello 2
Hello 1
Version_Sep_2013
C
SharpC
ode.org
For Loop…
for loop is similar to while, it's just written differently. for
statements are often used to proccess lists such a range of
numbers:
Basic syntax of for loop is as follows:Basic syntax of for loop is as follows:
for( initialization; condition; increment)
{ Single statement or Block of statements;
}
Version_Sep_2013
C
SharpC
ode.org
main()
{
int i; int j = 5;
for( i = 0; i <= j; i ++ )
{
printf("Hello %dn", i );
}
}}
Output
Hello 0
Hello 1
Hello 2
Hello 3
Hello 4
Hello 5
Version_Sep_2013
C
SharpC
ode.org
Break & Continue…
C provides two commands to control how we loop:
break -- exit form loop or switch.
continue -- skip 1 iteration of loop.
Break is used with switch caseBreak is used with switch case
Version_Sep_2013
C
SharpC
ode.org
main()
{
int i; int j = 5;
for( i = 0; i <= j; i ++ ) {
if( i == 3 )
{
break;
}}
printf("Hello %dn", i ); }
}
Output
Hello 0
Hello 1
Hello 2
Version_Sep_2013
C
SharpC
ode.org
Continue Example..
main()
{
int i; int j = 5;
for( i = 0; i <= j; i ++ )
{
if( i == 3 )
{{
continue;
}
printf("Hello %dn", i );
}
}
Output
Hello 0
Hello 1
Hello 2
Hello 4
Hello 5 Version_Sep_2013
C
SharpC
ode.org
Functions…
A function is a module or block of program code which
deals with a particular task.
Making functions is a way of isolating one block of code
from other independent blocks of code.from other independent blocks of code.
Functions serve two purposes.
1. They allow a programmer to say: `this piece of code does a
specific job which stands by itself and should not be mixed
up with anything else',
2. Second they make a block of code reusable since a function
can be reused in many different contexts without repeating
parts of the program text.
Version_Sep_2013
C
SharpC
ode.org
int add( int p1, int p2 ); //function declaration
void main()
{
int a = 10;
int b = 20, c;
c = add(a,b); //call to function
printf(“Addition is : %d”, c);printf(“Addition is : %d”, c);
}
int add( int p1, int p2 ) //function definition
{
return (p1+p2);
}
Version_Sep_2013
C
SharpC
ode.org
Exercise…
1. Find out factorial of given number
2. Check whether given number is prime number or not
3. Check whether given number is Armstrong number or
notnot
4. Calculate some of first 100 even numbers
5. Prepare calculator using switch
Version_Sep_2013
C
SharpC
ode.org
Ad

More Related Content

What's hot (20)

Conditional Statement in C Language
Conditional Statement in C LanguageConditional Statement in C Language
Conditional Statement in C Language
Shaina Arora
 
C programming decision making
C programming decision makingC programming decision making
C programming decision making
SENA
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
Sokngim Sa
 
Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
Tarun Sharma
 
Control structure
Control structureControl structure
Control structure
Samsil Arefin
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
Saad Sheikh
 
For Loop
For LoopFor Loop
For Loop
Ghaffar Khan
 
Decision making and branching
Decision making and branchingDecision making and branching
Decision making and branching
Hossain Md Shakhawat
 
Control structures in c
Control structures in cControl structures in c
Control structures in c
baabtra.com - No. 1 supplier of quality freshers
 
C++ decision making
C++ decision makingC++ decision making
C++ decision making
Zohaib Ahmed
 
Control structure in c
Control structure in cControl structure in c
Control structure in c
baabtra.com - No. 1 supplier of quality freshers
 
Looping Statement And Flow Chart
 Looping Statement And Flow Chart Looping Statement And Flow Chart
Looping Statement And Flow Chart
Rahul Sahu
 
Control Statement programming
Control Statement programmingControl Statement programming
Control Statement programming
University of Potsdam
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C ppt
MANJUTRIPATHI7
 
Bsit1
Bsit1Bsit1
Bsit1
jigeno
 
Programming fundamental 02
Programming fundamental 02Programming fundamental 02
Programming fundamental 02
Suhail Akraam
 
Structure in programming in c or c++ or c# or java
Structure in programming  in c or c++ or c# or javaStructure in programming  in c or c++ or c# or java
Structure in programming in c or c++ or c# or java
Samsil Arefin
 
Control structures in C
Control structures in CControl structures in C
Control structures in C
baabtra.com - No. 1 supplier of quality freshers
 
Selection Statements in C Programming
Selection Statements in C ProgrammingSelection Statements in C Programming
Selection Statements in C Programming
Kamal Acharya
 
Decision making and branching in c programming
Decision making and branching in c programmingDecision making and branching in c programming
Decision making and branching in c programming
Priyansh Thakar
 
Conditional Statement in C Language
Conditional Statement in C LanguageConditional Statement in C Language
Conditional Statement in C Language
Shaina Arora
 
C programming decision making
C programming decision makingC programming decision making
C programming decision making
SENA
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
Sokngim Sa
 
Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
Tarun Sharma
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
Saad Sheikh
 
C++ decision making
C++ decision makingC++ decision making
C++ decision making
Zohaib Ahmed
 
Looping Statement And Flow Chart
 Looping Statement And Flow Chart Looping Statement And Flow Chart
Looping Statement And Flow Chart
Rahul Sahu
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C ppt
MANJUTRIPATHI7
 
Programming fundamental 02
Programming fundamental 02Programming fundamental 02
Programming fundamental 02
Suhail Akraam
 
Structure in programming in c or c++ or c# or java
Structure in programming  in c or c++ or c# or javaStructure in programming  in c or c++ or c# or java
Structure in programming in c or c++ or c# or java
Samsil Arefin
 
Selection Statements in C Programming
Selection Statements in C ProgrammingSelection Statements in C Programming
Selection Statements in C Programming
Kamal Acharya
 
Decision making and branching in c programming
Decision making and branching in c programmingDecision making and branching in c programming
Decision making and branching in c programming
Priyansh Thakar
 

Similar to Programming basics (20)

What is c
What is cWhat is c
What is c
Nitesh Saitwal
 
Elements of programming
Elements of programmingElements of programming
Elements of programming
baabtra.com - No. 1 supplier of quality freshers
 
C Programming Unit-2
C Programming Unit-2C Programming Unit-2
C Programming Unit-2
Vikram Nandini
 
Control Structures in C
Control Structures in CControl Structures in C
Control Structures in C
sana shaikh
 
1584503386 1st chap
1584503386 1st chap1584503386 1st chap
1584503386 1st chap
thuhiendtk4
 
Fundamental of Information Technology - UNIT 8
Fundamental of Information Technology - UNIT 8Fundamental of Information Technology - UNIT 8
Fundamental of Information Technology - UNIT 8
Shipra Swati
 
Programming in C
Programming in CProgramming in C
Programming in C
Nishant Munjal
 
Decision statements in c laguage
Decision statements in c laguageDecision statements in c laguage
Decision statements in c laguage
Tanmay Modi
 
Principals of Programming in CModule -5.pdfModule_2_P2 (1).pdf
Principals of Programming in CModule -5.pdfModule_2_P2 (1).pdfPrincipals of Programming in CModule -5.pdfModule_2_P2 (1).pdf
Principals of Programming in CModule -5.pdfModule_2_P2 (1).pdf
anilcsbs
 
Basics of Control Statement in C Languages
Basics of Control Statement in C LanguagesBasics of Control Statement in C Languages
Basics of Control Statement in C Languages
Dr. Chandrakant Divate
 
computer programming Control Statements.pptx
computer programming Control Statements.pptxcomputer programming Control Statements.pptx
computer programming Control Statements.pptx
eaglesniper008
 
C_Language_PS&PC_Notes.ppt
C_Language_PS&PC_Notes.pptC_Language_PS&PC_Notes.ppt
C_Language_PS&PC_Notes.ppt
ganeshkarthy
 
PHP slides
PHP slidesPHP slides
PHP slides
Farzad Wadia
 
Control structure and Looping statements
Control structure and Looping statementsControl structure and Looping statements
Control structure and Looping statements
BalaKrishnan466
 
Module 2 - Control Structures c programming.pptm.pdf
Module 2 - Control Structures c programming.pptm.pdfModule 2 - Control Structures c programming.pptm.pdf
Module 2 - Control Structures c programming.pptm.pdf
SudipDebnath20
 
Fundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinaFundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medina
rurumedina
 
C Control Statements.docx
C Control Statements.docxC Control Statements.docx
C Control Statements.docx
JavvajiVenkat
 
INPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN C
INPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN CINPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN C
INPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN C
Dr. Chandrakant Divate
 
Control structuresin c
Control structuresin cControl structuresin c
Control structuresin c
Vikash Dhal
 
Learning C programming - from lynxbee.com
Learning C programming - from lynxbee.comLearning C programming - from lynxbee.com
Learning C programming - from lynxbee.com
Green Ecosystem
 
Control Structures in C
Control Structures in CControl Structures in C
Control Structures in C
sana shaikh
 
1584503386 1st chap
1584503386 1st chap1584503386 1st chap
1584503386 1st chap
thuhiendtk4
 
Fundamental of Information Technology - UNIT 8
Fundamental of Information Technology - UNIT 8Fundamental of Information Technology - UNIT 8
Fundamental of Information Technology - UNIT 8
Shipra Swati
 
Decision statements in c laguage
Decision statements in c laguageDecision statements in c laguage
Decision statements in c laguage
Tanmay Modi
 
Principals of Programming in CModule -5.pdfModule_2_P2 (1).pdf
Principals of Programming in CModule -5.pdfModule_2_P2 (1).pdfPrincipals of Programming in CModule -5.pdfModule_2_P2 (1).pdf
Principals of Programming in CModule -5.pdfModule_2_P2 (1).pdf
anilcsbs
 
Basics of Control Statement in C Languages
Basics of Control Statement in C LanguagesBasics of Control Statement in C Languages
Basics of Control Statement in C Languages
Dr. Chandrakant Divate
 
computer programming Control Statements.pptx
computer programming Control Statements.pptxcomputer programming Control Statements.pptx
computer programming Control Statements.pptx
eaglesniper008
 
C_Language_PS&PC_Notes.ppt
C_Language_PS&PC_Notes.pptC_Language_PS&PC_Notes.ppt
C_Language_PS&PC_Notes.ppt
ganeshkarthy
 
Control structure and Looping statements
Control structure and Looping statementsControl structure and Looping statements
Control structure and Looping statements
BalaKrishnan466
 
Module 2 - Control Structures c programming.pptm.pdf
Module 2 - Control Structures c programming.pptm.pdfModule 2 - Control Structures c programming.pptm.pdf
Module 2 - Control Structures c programming.pptm.pdf
SudipDebnath20
 
Fundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinaFundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medina
rurumedina
 
C Control Statements.docx
C Control Statements.docxC Control Statements.docx
C Control Statements.docx
JavvajiVenkat
 
INPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN C
INPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN CINPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN C
INPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN C
Dr. Chandrakant Divate
 
Control structuresin c
Control structuresin cControl structuresin c
Control structuresin c
Vikash Dhal
 
Learning C programming - from lynxbee.com
Learning C programming - from lynxbee.comLearning C programming - from lynxbee.com
Learning C programming - from lynxbee.com
Green Ecosystem
 
Ad

Recently uploaded (20)

spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
UPMVLE migration to ARAL. A step- by- step guide
UPMVLE migration to ARAL. A step- by- step guideUPMVLE migration to ARAL. A step- by- step guide
UPMVLE migration to ARAL. A step- by- step guide
abmerca
 
Cultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptxCultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptx
UmeshTimilsina1
 
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
UPMVLE migration to ARAL. A step- by- step guide
UPMVLE migration to ARAL. A step- by- step guideUPMVLE migration to ARAL. A step- by- step guide
UPMVLE migration to ARAL. A step- by- step guide
abmerca
 
Cultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptxCultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptx
UmeshTimilsina1
 
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
Ad

Programming basics

  • 2. Program.. Sequence of instructions written for specific purpose Like program to find out factorial of number Can be written in higher level programming languages that human can understandhuman can understand Those programs are translated to computer understandable languages Task will be done by special tool called compiler Version_Sep_2013 C SharpC ode.org
  • 3. Compiler will convert higher level language code to lower language code like binary code Most prior programming language was ‘C’ Rules & format that should be followed while writingRules & format that should be followed while writing program are called syntax Consider program to print “Hello!” on screen Version_Sep_2013 C SharpC ode.org
  • 4. void main() { printf(“Hello!”); }} Void main(), function and entry point of compilation Part within two curly brackets, is body of function Printf(), function to print sequence of characters on screen Version_Sep_2013 C SharpC ode.org
  • 5. Any programming language having three part 1. Data types 2. Keywords 3. Operators3. Operators Data types are like int, float, double Keyword are like printf, main, if, else The words that are pre-defined for compiler are keyword Keywords can not be used to define variable Version_Sep_2013 C SharpC ode.org
  • 6. We can define variable of data type Like int a; then ‘a’ will hold value of type int and is called variable Programs can have different type of statements likePrograms can have different type of statements like conditional statements and looping statements Conditional statements are for checking some condition Version_Sep_2013 C SharpC ode.org
  • 7. Conditional Statements… Conditional statements controls the sequence of statements, depending on the condition Relational operators allow comparing two values. 1. == is equal to1. == is equal to 2. != not equal to 3. < less than 4. > greater than 5. <= less than or equal to 6. >= greater than or equal to Version_Sep_2013 C SharpC ode.org
  • 8. SIMPLE IF STATEMENT It execute if condition is TRUE Syntax: if(condition) {{ Statement1; ..... Statement n; } Version_Sep_2013 C SharpC ode.org
  • 9. main() { int a,b; printf(“Enter a,b values:”); scanf(“%d %d”,&a,&b); if(a>b) { printf(“n a is greater than b”); }printf(“n a is greater than b”); } } OUTPUT: Enter a,b values:20 10 a is greater than b Version_Sep_2013 C SharpC ode.org
  • 10. IF-ELSE STATEMENT It execute IF condition is TRUE.IF condition is FLASE it execute ELSE part Syntax: if(condition) { Statement1;Statement1; ..... Statement n; } else { Statement1; ..... Statement n; } Version_Sep_2013 C SharpC ode.org
  • 11. main() { int a,b; printf(“Enter a,b values:”); scanf(“%d %d”,&a,&b); if(a>b) { printf(“n a is greater than b”); } else {else { printf(“nb is greater than b”); } } OUTPUT: Enter a,b values:10 20 b is greater than a Version_Sep_2013 C SharpC ode.org
  • 12. IF-ELSE IF STATEMENT: It execute IF condition is TRUE.IF condition is FLASE it checks ELSE IF part .ELSE IF is true then execute ELSE IF PART. This is also false it goes to ELSE part. Syntax: if(condition) { Statementn;Statementn; } else if(condition) { Statementn; } else { Statement n; } Version_Sep_2013 C SharpC ode.org
  • 13. main() { int a,b; printf(“Enter a,b values:”); scanf(“%d %d”,&a,&b); if(a>b) { printf(“n a is greater than b”); } else if(b>a) {else if(b>a) { printf(“nb is greater than b”); } else { printf(“n a is equal to b”); } } OUTPUT: Enter a,b values:10 10 a is equal to b Version_Sep_2013 C SharpC ode.org
  • 14. NESTED IF STATEMENT To check one conditoin within another. Take care of brace brackets within the conditions. Synatax: if(condition) {{ if(condition) { Statement n; } } else { Statement n; } Version_Sep_2013 C SharpC ode.org
  • 15. main() { int a,b; printf(“n Enter a and b values:”); scanf(“%d %d ”,&a,&b); if(a>b) { if((a!=0) && (b!=0)) { printf(“na and b both are +ve and a >b); } else {else { printf(“n a is greater than b only”) ; } } else { printf(“ na is less than b”); } } Output: Enter a and b values:30 20 a and b both are +ve and a > b Version_Sep_2013 C SharpC ode.org
  • 16. Switch..case The switch statement is much like a nested if .. else statement. switch statement can be slightly more efficient and easier to read. Syntax : switch( expression ) { case constant-expression1:case constant-expression1: statements1; break; case constant-expression2: statements2; break default : statements4; break; } Version_Sep_2013 C SharpC ode.org
  • 17. main() { char Grade = ‘B’; switch( Grade ) { case 'A' : printf( "Excellentn" ); break; case 'B' : printf( "Goodn" ); break; case 'C' :case 'C' : printf( "OKn" ); break; case 'D' : printf( "Mmmmm....n" ); break; default : printf( "What is your grade anyway?" ); break; } } Version_Sep_2013 C SharpC ode.org
  • 18. Looping… Loops provide a way to repeat commands and control how many times they are repeated. C provides a number of looping way. while loopwhile loop A while statement is like a repeating if statement. Like an If statement, if the test condition is true: the statements get executed. The difference is that after the statements have been executed, the test condition is checked again. If it is still true the statements get executed again. This cycle repeats until the test condition evaluates to false. Version_Sep_2013 C SharpC ode.org
  • 19. Basic syntax of while loop is as follows: while ( expression ) { Single statement or Block of statements;Single statement or Block of statements; } Will check for expression, until its true when it gets false execution will be stop Version_Sep_2013 C SharpC ode.org
  • 20. main() { int i = 5; while ( i > 0 ) { printf("Hello %dn", i ); i = i -1; } }} Output Hello 5 Hello 4 Hello 3 Hello 2 Hello 1 Version_Sep_2013 C SharpC ode.org
  • 21. Do..While do ... while is just like a while loop except that the test condition is checked at the end of the loop rather than the start. This has the effect that the content of the loop are alwaysThis has the effect that the content of the loop are always executed at least once. Basic syntax of do...while loop is as follows: do { Single statement or Block of statements; } while(expression); Version_Sep_2013 C SharpC ode.org
  • 22. main() { int i = 5; do{ printf("Hello %dn", i ); i = i -1; } while ( i > 0 ); }} Output Hello 5 Hello 4 Hello 3 Hello 2 Hello 1 Version_Sep_2013 C SharpC ode.org
  • 23. For Loop… for loop is similar to while, it's just written differently. for statements are often used to proccess lists such a range of numbers: Basic syntax of for loop is as follows:Basic syntax of for loop is as follows: for( initialization; condition; increment) { Single statement or Block of statements; } Version_Sep_2013 C SharpC ode.org
  • 24. main() { int i; int j = 5; for( i = 0; i <= j; i ++ ) { printf("Hello %dn", i ); } }} Output Hello 0 Hello 1 Hello 2 Hello 3 Hello 4 Hello 5 Version_Sep_2013 C SharpC ode.org
  • 25. Break & Continue… C provides two commands to control how we loop: break -- exit form loop or switch. continue -- skip 1 iteration of loop. Break is used with switch caseBreak is used with switch case Version_Sep_2013 C SharpC ode.org
  • 26. main() { int i; int j = 5; for( i = 0; i <= j; i ++ ) { if( i == 3 ) { break; }} printf("Hello %dn", i ); } } Output Hello 0 Hello 1 Hello 2 Version_Sep_2013 C SharpC ode.org
  • 27. Continue Example.. main() { int i; int j = 5; for( i = 0; i <= j; i ++ ) { if( i == 3 ) {{ continue; } printf("Hello %dn", i ); } } Output Hello 0 Hello 1 Hello 2 Hello 4 Hello 5 Version_Sep_2013 C SharpC ode.org
  • 28. Functions… A function is a module or block of program code which deals with a particular task. Making functions is a way of isolating one block of code from other independent blocks of code.from other independent blocks of code. Functions serve two purposes. 1. They allow a programmer to say: `this piece of code does a specific job which stands by itself and should not be mixed up with anything else', 2. Second they make a block of code reusable since a function can be reused in many different contexts without repeating parts of the program text. Version_Sep_2013 C SharpC ode.org
  • 29. int add( int p1, int p2 ); //function declaration void main() { int a = 10; int b = 20, c; c = add(a,b); //call to function printf(“Addition is : %d”, c);printf(“Addition is : %d”, c); } int add( int p1, int p2 ) //function definition { return (p1+p2); } Version_Sep_2013 C SharpC ode.org
  • 30. Exercise… 1. Find out factorial of given number 2. Check whether given number is prime number or not 3. Check whether given number is Armstrong number or notnot 4. Calculate some of first 100 even numbers 5. Prepare calculator using switch Version_Sep_2013 C SharpC ode.org
  翻译: