SlideShare une entreprise Scribd logo
1  sur  7
LAB 4
If statement
Exercise 1



• Given a positive number, print its square and
                  square root.
Exercise 2
• Write a C++ program to take a depth (in
 kilometers) inside the earth as input data;
 compute and display the temperature at that
 depth in degrees Celsius and Fahrenheit. The
 relevant formulas are:
           Celsius = 10 x (depth) + 20
        Farhrenheit = 1.8 x (Celsius) + 32
Exercise 3

• The arithmetic mean of two numbers is the
 result of dividing their some by 2. The geometric
 mean of two numbers is the square root of their
 product. The harmonic mean of two numbers is
 the arithmetic mean of their reciprocals. Write a
 program that takes two floating point numbers
 as inputs and displays these three means.
If statement

1. if (condition)         3. if (condition)
      statement;                statement;

2. if (condition)           else if (condition)
      statement;                statement;

   else                     else
      statement;                statement;
Example



• Write a C++ program to find the roots of the
 quadratic equations given its coefficients.
Pseudocode
1. Read a,b,c.
2. d=b*b - 4*a*c
3. if(d <0)
      Print "No real roots“
    else if(d=0)
      r = -b/2*a
      Print r
    else
      r1 = (-b+sqrt(d))/2*a
      r2 = (-b-sqrt(d))/2*a
      Print r1 , r2

Contenu connexe

Tendances

Armstrong calculator
Armstrong calculatorArmstrong calculator
Armstrong calculatorJayantBhatt6
 
Intermediate code generation
Intermediate code generationIntermediate code generation
Intermediate code generationRamchandraRegmi
 
Lecture 12 intermediate code generation
Lecture 12 intermediate code generationLecture 12 intermediate code generation
Lecture 12 intermediate code generationIffat Anjum
 
Csc1100 lecture10 ch08_pt1
Csc1100 lecture10 ch08_pt1Csc1100 lecture10 ch08_pt1
Csc1100 lecture10 ch08_pt1IIUM
 
Register Allocation
Register AllocationRegister Allocation
Register AllocationEelco Visser
 
Code generator
Code generatorCode generator
Code generatorTech_MX
 
Polish Notation In Data Structure
Polish Notation In Data StructurePolish Notation In Data Structure
Polish Notation In Data StructureMeghaj Mallick
 
Algebra 1, 5 3
Algebra 1, 5 3Algebra 1, 5 3
Algebra 1, 5 3Wood-Ridge
 
COMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTIONCOMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTIONAnil Pokhrel
 
Csc1100 lecture12 ch08_pt2
Csc1100 lecture12 ch08_pt2Csc1100 lecture12 ch08_pt2
Csc1100 lecture12 ch08_pt2IIUM
 
Chapter 6 intermediate code generation
Chapter 6   intermediate code generationChapter 6   intermediate code generation
Chapter 6 intermediate code generationVipul Naik
 

Tendances (20)

Armstrong calculator
Armstrong calculatorArmstrong calculator
Armstrong calculator
 
Intermediate code generation
Intermediate code generationIntermediate code generation
Intermediate code generation
 
Lecture 12 intermediate code generation
Lecture 12 intermediate code generationLecture 12 intermediate code generation
Lecture 12 intermediate code generation
 
Ch9b
Ch9bCh9b
Ch9b
 
Csc1100 lecture10 ch08_pt1
Csc1100 lecture10 ch08_pt1Csc1100 lecture10 ch08_pt1
Csc1100 lecture10 ch08_pt1
 
Register Allocation
Register AllocationRegister Allocation
Register Allocation
 
Code generator
Code generatorCode generator
Code generator
 
Ch9a
Ch9aCh9a
Ch9a
 
Polish Notation In Data Structure
Polish Notation In Data StructurePolish Notation In Data Structure
Polish Notation In Data Structure
 
Algebra 1, 5 3
Algebra 1, 5 3Algebra 1, 5 3
Algebra 1, 5 3
 
System software
System softwareSystem software
System software
 
Exercise #17 notes
Exercise #17 notesExercise #17 notes
Exercise #17 notes
 
Intermediate code generation
Intermediate code generationIntermediate code generation
Intermediate code generation
 
COMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTIONCOMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTION
 
Pointers
PointersPointers
Pointers
 
Vector Tools
Vector ToolsVector Tools
Vector Tools
 
Csc1100 lecture12 ch08_pt2
Csc1100 lecture12 ch08_pt2Csc1100 lecture12 ch08_pt2
Csc1100 lecture12 ch08_pt2
 
Ch8a
Ch8aCh8a
Ch8a
 
Pointer in c
Pointer in cPointer in c
Pointer in c
 
Chapter 6 intermediate code generation
Chapter 6   intermediate code generationChapter 6   intermediate code generation
Chapter 6 intermediate code generation
 

En vedette

Practical basics on c++
Practical basics on c++Practical basics on c++
Practical basics on c++Marco Izzotti
 
Introdução a linguagem c karen lowhany
Introdução a linguagem c   karen lowhanyIntrodução a linguagem c   karen lowhany
Introdução a linguagem c karen lowhanyKaren Costa
 
Practical C++ Generative Programming
Practical C++ Generative ProgrammingPractical C++ Generative Programming
Practical C++ Generative ProgrammingSchalk Cronjé
 
Lab manual of C++
Lab manual of C++Lab manual of C++
Lab manual of C++thesaqib
 
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board ExamsC++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Examshishamrizvi
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical FileAshwin Francis
 
C++ project on police station software
C++ project on police station softwareC++ project on police station software
C++ project on police station softwaredharmenderlodhi021
 
Material de Apoio de Algoritmo e Lógica de Programação
Material de Apoio de Algoritmo e Lógica de ProgramaçãoMaterial de Apoio de Algoritmo e Lógica de Programação
Material de Apoio de Algoritmo e Lógica de Programaçãorodfernandes
 
Computer science project work
Computer science project workComputer science project work
Computer science project workrahulchamp2345
 
Lista de exercicios algoritmos resolvida-
Lista de exercicios   algoritmos  resolvida-Lista de exercicios   algoritmos  resolvida-
Lista de exercicios algoritmos resolvida-Mauro Pereira
 

En vedette (15)

C++
C++C++
C++
 
C++ TUTORIAL 6
C++ TUTORIAL 6C++ TUTORIAL 6
C++ TUTORIAL 6
 
C++ practical lab
C++ practical labC++ practical lab
C++ practical lab
 
Practical basics on c++
Practical basics on c++Practical basics on c++
Practical basics on c++
 
Introdução a linguagem c karen lowhany
Introdução a linguagem c   karen lowhanyIntrodução a linguagem c   karen lowhany
Introdução a linguagem c karen lowhany
 
Practical C++ Generative Programming
Practical C++ Generative ProgrammingPractical C++ Generative Programming
Practical C++ Generative Programming
 
c++ lab manual
c++ lab manualc++ lab manual
c++ lab manual
 
Curso de Linguagem C
Curso de Linguagem CCurso de Linguagem C
Curso de Linguagem C
 
Lab manual of C++
Lab manual of C++Lab manual of C++
Lab manual of C++
 
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board ExamsC++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
 
C++ project on police station software
C++ project on police station softwareC++ project on police station software
C++ project on police station software
 
Material de Apoio de Algoritmo e Lógica de Programação
Material de Apoio de Algoritmo e Lógica de ProgramaçãoMaterial de Apoio de Algoritmo e Lógica de Programação
Material de Apoio de Algoritmo e Lógica de Programação
 
Computer science project work
Computer science project workComputer science project work
Computer science project work
 
Lista de exercicios algoritmos resolvida-
Lista de exercicios   algoritmos  resolvida-Lista de exercicios   algoritmos  resolvida-
Lista de exercicios algoritmos resolvida-
 

Similaire à C++ lab -4

Modelling handout
Modelling handoutModelling handout
Modelling handoutguru1561
 
Marco-Calculus-AB-Lesson-Plan (Important book for calculus).pdf
Marco-Calculus-AB-Lesson-Plan (Important book for calculus).pdfMarco-Calculus-AB-Lesson-Plan (Important book for calculus).pdf
Marco-Calculus-AB-Lesson-Plan (Important book for calculus).pdfUniversity of the Punjab
 
Workshop03.docx lap trinh C cho người mới bắt đầu
Workshop03.docx  lap trinh C cho người mới bắt đầuWorkshop03.docx  lap trinh C cho người mới bắt đầu
Workshop03.docx lap trinh C cho người mới bắt đầulinhtran111111111111
 
[Combined PDF 4.0] - Binomial Theorem.pdf
[Combined PDF 4.0] - Binomial Theorem.pdf[Combined PDF 4.0] - Binomial Theorem.pdf
[Combined PDF 4.0] - Binomial Theorem.pdfAryanPandey403424
 
Introduction to Python Programming.pptx
Introduction to Python Programming.pptxIntroduction to Python Programming.pptx
Introduction to Python Programming.pptxPython Homework Help
 
C Programing Arithmetic Operators.ppt
C Programing Arithmetic Operators.pptC Programing Arithmetic Operators.ppt
C Programing Arithmetic Operators.pptGAURAVNAUTIYAL19
 
basics of C and c++ by eteaching
basics of C and c++ by eteachingbasics of C and c++ by eteaching
basics of C and c++ by eteachingeteaching
 
Reed solomon Encoder and Decoder
Reed solomon Encoder and DecoderReed solomon Encoder and Decoder
Reed solomon Encoder and DecoderAmeer H Ali
 
Dti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpressionDti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpressionalish sha
 
Programming exercisesn NUMERICAL ANALYSIS
Programming exercisesn NUMERICAL ANALYSISProgramming exercisesn NUMERICAL ANALYSIS
Programming exercisesn NUMERICAL ANALYSISAli Ameer
 
tutorial5.ppt
tutorial5.ppttutorial5.ppt
tutorial5.pptjvjfvvoa
 

Similaire à C++ lab -4 (20)

random test
random testrandom test
random test
 
Revision1 C programming
Revision1 C programmingRevision1 C programming
Revision1 C programming
 
Programming Exam Help
 Programming Exam Help Programming Exam Help
Programming Exam Help
 
Modelling handout
Modelling handoutModelling handout
Modelling handout
 
Calculus Assignment Help
 Calculus Assignment Help Calculus Assignment Help
Calculus Assignment Help
 
Marco-Calculus-AB-Lesson-Plan (Important book for calculus).pdf
Marco-Calculus-AB-Lesson-Plan (Important book for calculus).pdfMarco-Calculus-AB-Lesson-Plan (Important book for calculus).pdf
Marco-Calculus-AB-Lesson-Plan (Important book for calculus).pdf
 
Workshop03.docx lap trinh C cho người mới bắt đầu
Workshop03.docx  lap trinh C cho người mới bắt đầuWorkshop03.docx  lap trinh C cho người mới bắt đầu
Workshop03.docx lap trinh C cho người mới bắt đầu
 
Goldie chapter 4 function
Goldie chapter 4 functionGoldie chapter 4 function
Goldie chapter 4 function
 
[Combined PDF 4.0] - Binomial Theorem.pdf
[Combined PDF 4.0] - Binomial Theorem.pdf[Combined PDF 4.0] - Binomial Theorem.pdf
[Combined PDF 4.0] - Binomial Theorem.pdf
 
Introduction to Python Programming.pptx
Introduction to Python Programming.pptxIntroduction to Python Programming.pptx
Introduction to Python Programming.pptx
 
C Programing Arithmetic Operators.ppt
C Programing Arithmetic Operators.pptC Programing Arithmetic Operators.ppt
C Programing Arithmetic Operators.ppt
 
Apclass (2)
Apclass (2)Apclass (2)
Apclass (2)
 
basics of C and c++ by eteaching
basics of C and c++ by eteachingbasics of C and c++ by eteaching
basics of C and c++ by eteaching
 
Reed solomon Encoder and Decoder
Reed solomon Encoder and DecoderReed solomon Encoder and Decoder
Reed solomon Encoder and Decoder
 
Dti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpressionDti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpression
 
Programming exercisesn NUMERICAL ANALYSIS
Programming exercisesn NUMERICAL ANALYSISProgramming exercisesn NUMERICAL ANALYSIS
Programming exercisesn NUMERICAL ANALYSIS
 
tutorial5.ppt
tutorial5.ppttutorial5.ppt
tutorial5.ppt
 
Cpl
CplCpl
Cpl
 
Complex nos demo 2
Complex nos demo 2Complex nos demo 2
Complex nos demo 2
 
Factoring
FactoringFactoring
Factoring
 

Dernier

Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 

Dernier (20)

Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 

C++ lab -4

  • 2. Exercise 1 • Given a positive number, print its square and square root.
  • 3. Exercise 2 • Write a C++ program to take a depth (in kilometers) inside the earth as input data; compute and display the temperature at that depth in degrees Celsius and Fahrenheit. The relevant formulas are: Celsius = 10 x (depth) + 20 Farhrenheit = 1.8 x (Celsius) + 32
  • 4. Exercise 3 • The arithmetic mean of two numbers is the result of dividing their some by 2. The geometric mean of two numbers is the square root of their product. The harmonic mean of two numbers is the arithmetic mean of their reciprocals. Write a program that takes two floating point numbers as inputs and displays these three means.
  • 5. If statement 1. if (condition) 3. if (condition) statement; statement; 2. if (condition) else if (condition) statement; statement; else else statement; statement;
  • 6. Example • Write a C++ program to find the roots of the quadratic equations given its coefficients.
  • 7. Pseudocode 1. Read a,b,c. 2. d=b*b - 4*a*c 3. if(d <0) Print "No real roots“ else if(d=0) r = -b/2*a Print r else r1 = (-b+sqrt(d))/2*a r2 = (-b-sqrt(d))/2*a Print r1 , r2