SlideShare a Scribd company logo
Lectures on Numerical Methods 1
Statements
 Expressions, when terminated by a semicolon, become statements.
 Examples
X = 5; I++; IsPrime(c); c = 5 * ( f – 32 ) / 9
 One can construct compound statements by putting statements and
declarations in Braces { and }. Also called blocks.
 Example
if ( rad > 0.0 )
{
float area = pi * rad * rad;
float peri = 2 * pi * rad;
printf( “Area = %fn” , area );
printf( “Peri = %fn” , peri );
}
else
printf( “Negative radiusn”);
Lectures on Numerical Methods 2
Labeled statements
 One can give a label to any statement. The form is
 Identifier : statement
 There are other labeled statements like case and default, to be used with
switch statement.
 Example
Lectures on Numerical Methods 3
If – else
 The if-else statement expresses simplest decision making. The
syntax is
if (expression)
statement1
elseopt
Statement2
 The expression is evaluated and if it is nonzero (true) then the
statement1 is executed. Otherwise, if else is present statement2 is
executed.
 Expression can just be numeric and need not be conditional
expression only.
 Statement1 and statement2 may be compound statements or blocks.
Lectures on Numerical Methods 4
If – else
if ( n > 0 )
if ( isPrime(n) ) {
printf(“%d is primen”,n);
return;
}
else
printf(“Input must be positiven”,n);
printf(“%d is non-primen”,n);
 Each else is associated with closest previous else-less if. Using this
principle multi-way decisions can be constructed.
Lectures on Numerical Methods 5
Switch
 The syntax of switch statement is
switch (expression) {
case const-expression1 : statement1
case const-expression2 : statement2
:
default : statementn
}
 All case expressions must be different. Expression must evaluate to an
integer.
 First the expression is evaluated. Then the value of expression is
compared with the case expressions. The execution begins at the case
statement, whose case expression matches. All the statements below are
executed.
 If default is present and if no other case matches then default statement
is executed.
Lectures on Numerical Methods 6
Switch
switch ( marks / 10 ) {
case 3 : grade = “DD”; break;
case 4 : grade = “CD”; break;
case 5 : grade = “CC”; break;
case 6 : grade = “BC”; break;
case 7 : grade = “BB”; break;
case 8 : grade = “AB”; break;
case 9 :
case 10 : grade = “AA”; break;
default : grade = “FF”; break;
}
Lectures on Numerical Methods 7
Iterations
 The three types of loops are given below.
while (expression) statement
for (expression1opt; expression2opt; expression3opt)
statement
do statement while(expression);
 In while loop the expression (which must be arithmetic) is evaluated and
if the value is nonzero, then the statement is executed. The process is
continued till the expression becomes zero. The expression is evaluated
before the iteration.
 For statement is equivalent to
expression1;
while ( expression2 ) {
statement
expression3;
}
Lectures on Numerical Methods 8
Iterations
 In the do loop, the statement is executed and then the expression is
evaluated. If the expression is nonzero the process is repeated. Thus
the condition is evaluated at the end of each iteration.
 Example
x1 = 1;
do {
x0 = x1;
x1 = x0 – f(x0) / derf(x0);
} while ( fabs(x1 – x0) > FLT_EPSILON ) ;
 We needed to evaluate x1 before we could apply the convergence
criterion.
Lectures on Numerical Methods 9
Break and Continue
 The loops have one expression that decides whether the iterative
process should be terminated. It is sometimes convenient to be able to
exit from the loop.
 break statement provides an early exit from the for, while and do
loops.
 It also provides an exit from switch statement.
 continue statement causes the jump to the end of the loop body,
skipping the statements only once. The loop may continue.
while (...) {
...
continue;
...
cont: ;
}
do {
...
continue;
...
cont: ;
}
for (...) {
...
continue;
...
cont: ;
}
Lectures on Numerical Methods 10
Break and continue
 Example
for ( i = 0; i < n; i++ ) {
if ( a[i] < 0 ) continue;
/* Process only non-negative elements of the array */
...
}
 Example
for ( i = 2; i <= (int)sqrt(n); i++ ) {
if ( n % i == 0 ) break;
if ( n % i ) printf(“Primen”);
else printf(“Not primen”);
Ad

More Related Content

Similar to lecture about visual basic studio 6.0 presentation (20)

Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
Saad Sheikh
 
Decision statements in c language
Decision statements in c languageDecision statements in c language
Decision statements in c language
tanmaymodi4
 
Decision statements in c laguage
Decision statements in c laguageDecision statements in c laguage
Decision statements in c laguage
Tanmay Modi
 
Chapter 8 - Conditional Statement
Chapter 8 - Conditional StatementChapter 8 - Conditional Statement
Chapter 8 - Conditional Statement
Deepak Singh
 
Unit 2=Decision Control & Looping Statements.pdf
Unit 2=Decision Control & Looping Statements.pdfUnit 2=Decision Control & Looping Statements.pdf
Unit 2=Decision Control & Looping Statements.pdf
Dr. Ambedkar Institute of Technology, Bangalore 56
 
Lecture 10 - Control Structures 2
Lecture 10 - Control Structures 2Lecture 10 - Control Structures 2
Lecture 10 - Control Structures 2
Md. Imran Hossain Showrov
 
C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Decision making in C(2020-2021) statements
Decision making in C(2020-2021) statementsDecision making in C(2020-2021) statements
Decision making in C(2020-2021) statements
BalaKrishnan466
 
Unit-2 control Structures.pptx.pptx20201
Unit-2 control Structures.pptx.pptx20201Unit-2 control Structures.pptx.pptx20201
Unit-2 control Structures.pptx.pptx20201
vpenubot
 
Constructs (Programming Methodology)
Constructs (Programming Methodology)Constructs (Programming Methodology)
Constructs (Programming Methodology)
Jyoti Bhardwaj
 
Controls & Loops in C
Controls & Loops in C Controls & Loops in C
Controls & Loops in C
Thesis Scientist Private Limited
 
3-Conditional-if-else-switch btech computer in c.pdf
3-Conditional-if-else-switch btech computer in c.pdf3-Conditional-if-else-switch btech computer in c.pdf
3-Conditional-if-else-switch btech computer in c.pdf
ArkSingh7
 
If statements in c programming
If statements in c programmingIf statements in c programming
If statements in c programming
Archana Gopinath
 
Ch5 Selection Statements
Ch5 Selection StatementsCh5 Selection Statements
Ch5 Selection Statements
SzeChingChen
 
control-statements in C Language MH.pptx
control-statements in C Language MH.pptxcontrol-statements in C Language MH.pptx
control-statements in C Language MH.pptx
mehedi_hasan
 
Mca i pic u-3 handling input output and control statements
Mca i pic u-3 handling input output and control statementsMca i pic u-3 handling input output and control statements
Mca i pic u-3 handling input output and control statements
Rai University
 
Chapter 4(1)
Chapter 4(1)Chapter 4(1)
Chapter 4(1)
TejaswiB4
 
C statements.ppt presentation in c language
C statements.ppt presentation in c languageC statements.ppt presentation in c language
C statements.ppt presentation in c language
chintupro9
 
handling input output and control statements
 handling input output and control statements handling input output and control statements
handling input output and control statements
Rai University
 
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
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
Saad Sheikh
 
Decision statements in c language
Decision statements in c languageDecision statements in c language
Decision statements in c language
tanmaymodi4
 
Decision statements in c laguage
Decision statements in c laguageDecision statements in c laguage
Decision statements in c laguage
Tanmay Modi
 
Chapter 8 - Conditional Statement
Chapter 8 - Conditional StatementChapter 8 - Conditional Statement
Chapter 8 - Conditional Statement
Deepak Singh
 
Decision making in C(2020-2021) statements
Decision making in C(2020-2021) statementsDecision making in C(2020-2021) statements
Decision making in C(2020-2021) statements
BalaKrishnan466
 
Unit-2 control Structures.pptx.pptx20201
Unit-2 control Structures.pptx.pptx20201Unit-2 control Structures.pptx.pptx20201
Unit-2 control Structures.pptx.pptx20201
vpenubot
 
Constructs (Programming Methodology)
Constructs (Programming Methodology)Constructs (Programming Methodology)
Constructs (Programming Methodology)
Jyoti Bhardwaj
 
3-Conditional-if-else-switch btech computer in c.pdf
3-Conditional-if-else-switch btech computer in c.pdf3-Conditional-if-else-switch btech computer in c.pdf
3-Conditional-if-else-switch btech computer in c.pdf
ArkSingh7
 
If statements in c programming
If statements in c programmingIf statements in c programming
If statements in c programming
Archana Gopinath
 
Ch5 Selection Statements
Ch5 Selection StatementsCh5 Selection Statements
Ch5 Selection Statements
SzeChingChen
 
control-statements in C Language MH.pptx
control-statements in C Language MH.pptxcontrol-statements in C Language MH.pptx
control-statements in C Language MH.pptx
mehedi_hasan
 
Mca i pic u-3 handling input output and control statements
Mca i pic u-3 handling input output and control statementsMca i pic u-3 handling input output and control statements
Mca i pic u-3 handling input output and control statements
Rai University
 
Chapter 4(1)
Chapter 4(1)Chapter 4(1)
Chapter 4(1)
TejaswiB4
 
C statements.ppt presentation in c language
C statements.ppt presentation in c languageC statements.ppt presentation in c language
C statements.ppt presentation in c language
chintupro9
 
handling input output and control statements
 handling input output and control statements handling input output and control statements
handling input output and control statements
Rai University
 
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
 

More from GayathriShiva4 (7)

Data Analytic s (Unit -1).pRESENTATION .PPT
Data Analytic s (Unit -1).pRESENTATION .PPTData Analytic s (Unit -1).pRESENTATION .PPT
Data Analytic s (Unit -1).pRESENTATION .PPT
GayathriShiva4
 
DataScienceUsingR-Dr.P.Rajesh.PRESENTATION
DataScienceUsingR-Dr.P.Rajesh.PRESENTATIONDataScienceUsingR-Dr.P.Rajesh.PRESENTATION
DataScienceUsingR-Dr.P.Rajesh.PRESENTATION
GayathriShiva4
 
Precedence of operators IN C PROGRAMMING
Precedence of operators IN C PROGRAMMINGPrecedence of operators IN C PROGRAMMING
Precedence of operators IN C PROGRAMMING
GayathriShiva4
 
Operators in Computer programming presentation
Operators in Computer programming presentationOperators in Computer programming presentation
Operators in Computer programming presentation
GayathriShiva4
 
ACCIDENT PREVENTING WHILE TRAVELLING IN CAR
ACCIDENT PREVENTING WHILE TRAVELLING IN CARACCIDENT PREVENTING WHILE TRAVELLING IN CAR
ACCIDENT PREVENTING WHILE TRAVELLING IN CAR
GayathriShiva4
 
Variables, identifiers, constants, declaration in c
Variables, identifiers, constants, declaration in cVariables, identifiers, constants, declaration in c
Variables, identifiers, constants, declaration in c
GayathriShiva4
 
270_1_ChapterIntro_Up_To_Functions (1).ppt
270_1_ChapterIntro_Up_To_Functions (1).ppt270_1_ChapterIntro_Up_To_Functions (1).ppt
270_1_ChapterIntro_Up_To_Functions (1).ppt
GayathriShiva4
 
Data Analytic s (Unit -1).pRESENTATION .PPT
Data Analytic s (Unit -1).pRESENTATION .PPTData Analytic s (Unit -1).pRESENTATION .PPT
Data Analytic s (Unit -1).pRESENTATION .PPT
GayathriShiva4
 
DataScienceUsingR-Dr.P.Rajesh.PRESENTATION
DataScienceUsingR-Dr.P.Rajesh.PRESENTATIONDataScienceUsingR-Dr.P.Rajesh.PRESENTATION
DataScienceUsingR-Dr.P.Rajesh.PRESENTATION
GayathriShiva4
 
Precedence of operators IN C PROGRAMMING
Precedence of operators IN C PROGRAMMINGPrecedence of operators IN C PROGRAMMING
Precedence of operators IN C PROGRAMMING
GayathriShiva4
 
Operators in Computer programming presentation
Operators in Computer programming presentationOperators in Computer programming presentation
Operators in Computer programming presentation
GayathriShiva4
 
ACCIDENT PREVENTING WHILE TRAVELLING IN CAR
ACCIDENT PREVENTING WHILE TRAVELLING IN CARACCIDENT PREVENTING WHILE TRAVELLING IN CAR
ACCIDENT PREVENTING WHILE TRAVELLING IN CAR
GayathriShiva4
 
Variables, identifiers, constants, declaration in c
Variables, identifiers, constants, declaration in cVariables, identifiers, constants, declaration in c
Variables, identifiers, constants, declaration in c
GayathriShiva4
 
270_1_ChapterIntro_Up_To_Functions (1).ppt
270_1_ChapterIntro_Up_To_Functions (1).ppt270_1_ChapterIntro_Up_To_Functions (1).ppt
270_1_ChapterIntro_Up_To_Functions (1).ppt
GayathriShiva4
 
Ad

Recently uploaded (20)

Module_2_Types_and_Approaches_of_Research (2).pptx
Module_2_Types_and_Approaches_of_Research (2).pptxModule_2_Types_and_Approaches_of_Research (2).pptx
Module_2_Types_and_Approaches_of_Research (2).pptx
drroxannekemp
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
MCQS (EMERGENCY NURSING) DR. NASIR MUSTAFA
MCQS (EMERGENCY NURSING) DR. NASIR MUSTAFAMCQS (EMERGENCY NURSING) DR. NASIR MUSTAFA
MCQS (EMERGENCY NURSING) DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Peer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docx
Peer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docxPeer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docx
Peer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docx
19lburrell
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
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
 
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
 
INDIA QUIZ FOR SCHOOLS | THE QUIZ CLUB OF PSGCAS | AUGUST 2024
INDIA QUIZ FOR SCHOOLS | THE QUIZ CLUB OF PSGCAS | AUGUST 2024INDIA QUIZ FOR SCHOOLS | THE QUIZ CLUB OF PSGCAS | AUGUST 2024
INDIA QUIZ FOR SCHOOLS | THE QUIZ CLUB OF PSGCAS | AUGUST 2024
Quiz Club of PSG College of Arts & Science
 
Unit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptx
Unit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptxUnit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptx
Unit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptx
Mayuri Chavan
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
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
 
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
 
How to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 InventoryHow to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 Inventory
Celine George
 
MICROBIAL GENETICS -tranformation and tranduction.pdf
MICROBIAL GENETICS -tranformation and tranduction.pdfMICROBIAL GENETICS -tranformation and tranduction.pdf
MICROBIAL GENETICS -tranformation and tranduction.pdf
DHARMENDRA SAHU
 
Cyber security COPA ITI MCQ Top Questions
Cyber security COPA ITI MCQ Top QuestionsCyber security COPA ITI MCQ Top Questions
Cyber security COPA ITI MCQ Top Questions
SONU HEETSON
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
Module_2_Types_and_Approaches_of_Research (2).pptx
Module_2_Types_and_Approaches_of_Research (2).pptxModule_2_Types_and_Approaches_of_Research (2).pptx
Module_2_Types_and_Approaches_of_Research (2).pptx
drroxannekemp
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
MCQS (EMERGENCY NURSING) DR. NASIR MUSTAFA
MCQS (EMERGENCY NURSING) DR. NASIR MUSTAFAMCQS (EMERGENCY NURSING) DR. NASIR MUSTAFA
MCQS (EMERGENCY NURSING) DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Peer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docx
Peer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docxPeer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docx
Peer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docx
19lburrell
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
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
 
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
 
Unit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptx
Unit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptxUnit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptx
Unit 5 ACUTE, SUBACUTE,CHRONIC TOXICITY.pptx
Mayuri Chavan
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
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
 
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
 
How to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 InventoryHow to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 Inventory
Celine George
 
MICROBIAL GENETICS -tranformation and tranduction.pdf
MICROBIAL GENETICS -tranformation and tranduction.pdfMICROBIAL GENETICS -tranformation and tranduction.pdf
MICROBIAL GENETICS -tranformation and tranduction.pdf
DHARMENDRA SAHU
 
Cyber security COPA ITI MCQ Top Questions
Cyber security COPA ITI MCQ Top QuestionsCyber security COPA ITI MCQ Top Questions
Cyber security COPA ITI MCQ Top Questions
SONU HEETSON
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
Ad

lecture about visual basic studio 6.0 presentation

  • 1. Lectures on Numerical Methods 1 Statements  Expressions, when terminated by a semicolon, become statements.  Examples X = 5; I++; IsPrime(c); c = 5 * ( f – 32 ) / 9  One can construct compound statements by putting statements and declarations in Braces { and }. Also called blocks.  Example if ( rad > 0.0 ) { float area = pi * rad * rad; float peri = 2 * pi * rad; printf( “Area = %fn” , area ); printf( “Peri = %fn” , peri ); } else printf( “Negative radiusn”);
  • 2. Lectures on Numerical Methods 2 Labeled statements  One can give a label to any statement. The form is  Identifier : statement  There are other labeled statements like case and default, to be used with switch statement.  Example
  • 3. Lectures on Numerical Methods 3 If – else  The if-else statement expresses simplest decision making. The syntax is if (expression) statement1 elseopt Statement2  The expression is evaluated and if it is nonzero (true) then the statement1 is executed. Otherwise, if else is present statement2 is executed.  Expression can just be numeric and need not be conditional expression only.  Statement1 and statement2 may be compound statements or blocks.
  • 4. Lectures on Numerical Methods 4 If – else if ( n > 0 ) if ( isPrime(n) ) { printf(“%d is primen”,n); return; } else printf(“Input must be positiven”,n); printf(“%d is non-primen”,n);  Each else is associated with closest previous else-less if. Using this principle multi-way decisions can be constructed.
  • 5. Lectures on Numerical Methods 5 Switch  The syntax of switch statement is switch (expression) { case const-expression1 : statement1 case const-expression2 : statement2 : default : statementn }  All case expressions must be different. Expression must evaluate to an integer.  First the expression is evaluated. Then the value of expression is compared with the case expressions. The execution begins at the case statement, whose case expression matches. All the statements below are executed.  If default is present and if no other case matches then default statement is executed.
  • 6. Lectures on Numerical Methods 6 Switch switch ( marks / 10 ) { case 3 : grade = “DD”; break; case 4 : grade = “CD”; break; case 5 : grade = “CC”; break; case 6 : grade = “BC”; break; case 7 : grade = “BB”; break; case 8 : grade = “AB”; break; case 9 : case 10 : grade = “AA”; break; default : grade = “FF”; break; }
  • 7. Lectures on Numerical Methods 7 Iterations  The three types of loops are given below. while (expression) statement for (expression1opt; expression2opt; expression3opt) statement do statement while(expression);  In while loop the expression (which must be arithmetic) is evaluated and if the value is nonzero, then the statement is executed. The process is continued till the expression becomes zero. The expression is evaluated before the iteration.  For statement is equivalent to expression1; while ( expression2 ) { statement expression3; }
  • 8. Lectures on Numerical Methods 8 Iterations  In the do loop, the statement is executed and then the expression is evaluated. If the expression is nonzero the process is repeated. Thus the condition is evaluated at the end of each iteration.  Example x1 = 1; do { x0 = x1; x1 = x0 – f(x0) / derf(x0); } while ( fabs(x1 – x0) > FLT_EPSILON ) ;  We needed to evaluate x1 before we could apply the convergence criterion.
  • 9. Lectures on Numerical Methods 9 Break and Continue  The loops have one expression that decides whether the iterative process should be terminated. It is sometimes convenient to be able to exit from the loop.  break statement provides an early exit from the for, while and do loops.  It also provides an exit from switch statement.  continue statement causes the jump to the end of the loop body, skipping the statements only once. The loop may continue. while (...) { ... continue; ... cont: ; } do { ... continue; ... cont: ; } for (...) { ... continue; ... cont: ; }
  • 10. Lectures on Numerical Methods 10 Break and continue  Example for ( i = 0; i < n; i++ ) { if ( a[i] < 0 ) continue; /* Process only non-negative elements of the array */ ... }  Example for ( i = 2; i <= (int)sqrt(n); i++ ) { if ( n % i == 0 ) break; if ( n % i ) printf(“Primen”); else printf(“Not primen”);
  翻译: