SlideShare a Scribd company logo
BOP Lab Exercise Page 1
Riphah University Faisalabad
Lab Exercise
BOP
Department of Computer Science
Muhammad Ali Saeed
shk.alisaeed@gmail.com
Riphah,FsdCampus
BOP Lab Exercise Page 2
Exercise
Objectives:
C++ Basics
INSTRUCTIONS:
 Write well-formatted & user-friendly programs.
 Create a new (empty) project for each problem.
 Submit a word file with your source code each task and screenshot of output
 Name the word file in format NAME_ROLL#_CLASS_SECTION
 10% penalty for not following the naming rules mentioned in the manual.
 Do not use unnecessary variables.
Problem(s) / Assignment(s)
1. Create a new (empty) projectin MS Visual Studio as guided to you. Give it a
name as
follows: BOP_Section_Roll#_Name#
2. Add a new C++ sourcefile in your project. Give it a name as follows:
Section_Roll#_Q#
3. Write a C++ statement in your sourcefile to performthe following tasks.
NOTE: Write a C++ statement(s) for each of the following task one after the other,
in the same order. You have to submitONE word file containing source code and
screenshotsof all the tasks.
a) Print the message“Hi my name is Ali and and I am CS student ” on one line.
b) Printthe message“This is my C++ lab Program” on two lines using two cout
statements. The firstline ends at ‘lab’.
You have a message“I am fromIslamabad G-11/1”. Display each word of this
messageon a new line.
1. Print the message“I am happy in Faisal Abad”. Display each word of this
message
separated by a tab.
Problem1: Cout Statements Estimated completiontime:10mins
Riphah,FsdCampus
BOP Lab Exercise Page 3
Write a programthat asks the user to enter two numbers, obtains the two
numbers from the user and prints the sum, productand difference of the two
numbers.
You have to write a program to take input of temperature in Fahrenheit and convert it to
centigrade it and kelvin.
Fahrenheit To Centigrade: 5/9 * (Fahrenheit - 32);
ii) Fahrenheit To Kelvin: (5/9 * (Fahrenheit - 32) + 273 );
your output should be like this:
==%%===Temperature Counting of RIPHAH Faisalabad===%%===
Enter Temperature In Farenheit.
=====||====Temperature====||=====
Temperature in Fahrenheit:
Temperature in Centigrade:
Temperature in Kelvin:
||-----------------------------------------------------------------------------------------||
Problem4: Use controlled structures like if else Estimated completiontime:10 mins
a. Write a program which determines the nature of input of word entered from
keyboard.(i.e. an alphabet ‘A’ typed from keyboard would be a Capital letter and ‘4’ is an
integer)
(HINT: Use ASCII Table)
b. Write a program which take three inputs from the user and determine if these could make
sides of right triangle or equilateral triangle.
Problem2: Variables Estimated completiontime:10mins
Problem3: Variables Estimated completiontime:15mins
Riphah,FsdCampus
BOP Lab Exercise Page 4
The Pythagorean Theorem tells us that the relationship in every right triangle is:
a2+b2=c2
Print the following output using for loop?
1
12
123
1234
Up to 10
HINT: Nested Loop may help. THINK
.
Inputa number fromuser and write a programto print a table of a given number
using while loop statement.
Write a C++ programto enter an int number from user. Your programdisplay
the message“I loveRIPHAH-FSD” as many time as you enter the number and
message“FSD is industrialcity” only one time using continue and break statement
to control you loop (for,while).
For example user enter 3 the programdisplay:
Problem5: Use For Loop. Estimated completiontime:10mins
Problem6: While Loop Estimated completiontime:15mins
Problem7: Estimated completiontime:20mins
Riphah,FsdCampus
BOP Lab Exercise Page 5
I love RIPHAH-FSD
I love RIPHAH-FSD
I love RIPHAH-FSD
----------xxxxxx---------
FSD is industrialcity
Write a programthat uses do while loops to performthe following steps:
a. Promptthe user to input two integers: firstNumand secondNum
(firstNummustbe less than secondNum).
b. Outputall odd numbers between firstNumand secondNum.
c. Outputthe sumof all even numbers between firstNumand secondNum
d. Outputthe sumof the squareof the odd numbers between firstNum and
secondNum
Effective January 1st of each year, Ali receives a 5% raiseon his previous
year’s salary. Hewants a programthat calculates and displays the amount of his
annual raises for the next three years. Theprogramalso should calculate and
display his total salary for the ten years.
Write the code to display a table consisting of four rows and six columns. The
firstcolumn should contain the numbers 1 through 4 raised to the first power.
The second column should contain the result of raising the number in the first
column to the second power. The third column should contain the resultof raising
the number in the firstcolumn to the third power, and so on. The table will look
Problem8: Do while loops or use any loop Estimated completiontime:15mins
Problem9: While and do-while loop statements Estimated completiontime:15mins
Problem10: Estimated completiontime:20mins
Riphah,FsdCampus
BOP Lab Exercise Page 6
similar to the one shown in Figure. Use two for statements: one to keep track of
the numbers 1 through 4, and the other to keep track of the powers (1 to 6)
Use C++ pow function
1 1 1 1 1 1
2 4 8 16 32 64
3 9 27 81 243 729
4 16 64 256 1024 4096
You are done with your exercise(s), make your submission 

More Related Content

What's hot

Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10
alish sha
 
Arithmetic operator
Arithmetic operatorArithmetic operator
Arithmetic operator
Md Masudur Rahman
 
Project scheduling and tracking
Project scheduling and trackingProject scheduling and tracking
Project scheduling and tracking
yenohhoney
 

What's hot (18)

Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10
 
Arithmetic operator
Arithmetic operatorArithmetic operator
Arithmetic operator
 
Cs8261 cp lab syllabus
Cs8261 cp lab syllabusCs8261 cp lab syllabus
Cs8261 cp lab syllabus
 
Software measurement and estimation
Software measurement and estimationSoftware measurement and estimation
Software measurement and estimation
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Fundamental
FundamentalFundamental
Fundamental
 
csharp_Passing_parameters_by_value_and_reference
csharp_Passing_parameters_by_value_and_referencecsharp_Passing_parameters_by_value_and_reference
csharp_Passing_parameters_by_value_and_reference
 
Arithmetic and Arithmetic assignment operators
Arithmetic and Arithmetic assignment operatorsArithmetic and Arithmetic assignment operators
Arithmetic and Arithmetic assignment operators
 
Project scheduling and tracking
Project scheduling and trackingProject scheduling and tracking
Project scheduling and tracking
 
Car Parking System
Car Parking SystemCar Parking System
Car Parking System
 
Comp 122 lab 1 lab report and source code
Comp 122 lab 1 lab report and source codeComp 122 lab 1 lab report and source code
Comp 122 lab 1 lab report and source code
 
CS151 Functions lecture
CS151 Functions lectureCS151 Functions lecture
CS151 Functions lecture
 
Sequential multiplication
Sequential multiplicationSequential multiplication
Sequential multiplication
 
Lecture 3 time complexity
Lecture 3 time complexityLecture 3 time complexity
Lecture 3 time complexity
 
Unit 4-booth algorithm
Unit 4-booth algorithmUnit 4-booth algorithm
Unit 4-booth algorithm
 
C coding#1
C   coding#1C   coding#1
C coding#1
 
Day 3 chapter 2 unit 1
Day 3 chapter 2 unit 1Day 3 chapter 2 unit 1
Day 3 chapter 2 unit 1
 
Mississauga Interlocking Paver Estimate Worksheet
Mississauga Interlocking Paver Estimate WorksheetMississauga Interlocking Paver Estimate Worksheet
Mississauga Interlocking Paver Estimate Worksheet
 

Viewers also liked

C&S SOCIOECONOMICO
C&S SOCIOECONOMICOC&S SOCIOECONOMICO
C&S SOCIOECONOMICO
Luis Soto
 
Capítulo 1 la anatomía de los ples. entornos personales de aprendizaje clav...
Capítulo 1 la anatomía de los ples.  entornos personales de aprendizaje  clav...Capítulo 1 la anatomía de los ples.  entornos personales de aprendizaje  clav...
Capítulo 1 la anatomía de los ples. entornos personales de aprendizaje clav...
maria justina yocupicio
 
Castell ALIS Launch pr2
Castell ALIS Launch pr2Castell ALIS Launch pr2
Castell ALIS Launch pr2
Peggy Berg
 
Dn12 u3 a6_roda
Dn12 u3 a6_rodaDn12 u3 a6_roda
Dn12 u3 a6_roda
Axellin
 
Evan Kirou Portfolio 2010_2016
Evan Kirou Portfolio 2010_2016Evan Kirou Portfolio 2010_2016
Evan Kirou Portfolio 2010_2016
Evan Kirou
 

Viewers also liked (20)

C&S SOCIOECONOMICO
C&S SOCIOECONOMICOC&S SOCIOECONOMICO
C&S SOCIOECONOMICO
 
Capítulo 1 la anatomía de los ples. entornos personales de aprendizaje clav...
Capítulo 1 la anatomía de los ples.  entornos personales de aprendizaje  clav...Capítulo 1 la anatomía de los ples.  entornos personales de aprendizaje  clav...
Capítulo 1 la anatomía de los ples. entornos personales de aprendizaje clav...
 
Castell ALIS Launch pr2
Castell ALIS Launch pr2Castell ALIS Launch pr2
Castell ALIS Launch pr2
 
E learning
E learningE learning
E learning
 
La mejor motivación del mundo
La mejor motivación del mundo La mejor motivación del mundo
La mejor motivación del mundo
 
Webinar | Empleo 2.0 - Haz que el Nethunter te encuentre
Webinar | Empleo 2.0 - Haz que el Nethunter te encuentreWebinar | Empleo 2.0 - Haz que el Nethunter te encuentre
Webinar | Empleo 2.0 - Haz que el Nethunter te encuentre
 
Cómo conseguir trabajo con tu Marca Personal
Cómo conseguir trabajo con tu Marca PersonalCómo conseguir trabajo con tu Marca Personal
Cómo conseguir trabajo con tu Marca Personal
 
Cómo utilizar las Redes Sociales en la búsqueda de empleo
Cómo utilizar las Redes Sociales en la búsqueda de empleoCómo utilizar las Redes Sociales en la búsqueda de empleo
Cómo utilizar las Redes Sociales en la búsqueda de empleo
 
Dn12 u3 a3_roda
Dn12 u3 a3_rodaDn12 u3 a3_roda
Dn12 u3 a3_roda
 
Dn12 u3 a7_roda
Dn12 u3 a7_rodaDn12 u3 a7_roda
Dn12 u3 a7_roda
 
Dn12 3 eval_roda
Dn12 3 eval_rodaDn12 3 eval_roda
Dn12 3 eval_roda
 
Navegadores Web
Navegadores Web Navegadores Web
Navegadores Web
 
Dn12 u3 a8_roda
Dn12 u3 a8_rodaDn12 u3 a8_roda
Dn12 u3 a8_roda
 
Kagc College 2017
Kagc College 2017Kagc College 2017
Kagc College 2017
 
Dn12 u3 a6_roda
Dn12 u3 a6_rodaDn12 u3 a6_roda
Dn12 u3 a6_roda
 
Dn12 u3 a10_roda
Dn12 u3 a10_rodaDn12 u3 a10_roda
Dn12 u3 a10_roda
 
Prop List
Prop ListProp List
Prop List
 
Evan Kirou Portfolio 2010_2016
Evan Kirou Portfolio 2010_2016Evan Kirou Portfolio 2010_2016
Evan Kirou Portfolio 2010_2016
 
Dn12 3 eval_roda
Dn12 3 eval_rodaDn12 3 eval_roda
Dn12 3 eval_roda
 
Dn12 u3 a5_roda
Dn12 u3 a5_rodaDn12 u3 a5_roda
Dn12 u3 a5_roda
 

Similar to c++ Question

Year 2 dsa c++ exercises on user defined functions
Year 2 dsa  c++ exercises on user defined functionsYear 2 dsa  c++ exercises on user defined functions
Year 2 dsa c++ exercises on user defined functions
ErnesteNtezirizaza
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
AASTHA76
 
Project 2Project 2.pdfIntroduction to Programming EECS 1.docx
Project 2Project 2.pdfIntroduction to Programming  EECS 1.docxProject 2Project 2.pdfIntroduction to Programming  EECS 1.docx
Project 2Project 2.pdfIntroduction to Programming EECS 1.docx
wkyra78
 

Similar to c++ Question (20)

Programming Fundamental handouts
Programming Fundamental handoutsProgramming Fundamental handouts
Programming Fundamental handouts
 
COMP 122 Entire Course NEW
COMP 122 Entire Course NEWCOMP 122 Entire Course NEW
COMP 122 Entire Course NEW
 
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab new
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab new
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab new
 
C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17
 
Cmis 102 Effective Communication / snaptutorial.com
Cmis 102  Effective Communication / snaptutorial.comCmis 102  Effective Communication / snaptutorial.com
Cmis 102 Effective Communication / snaptutorial.com
 
Cmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.comCmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.com
 
Cmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.comCmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.com
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
 
Year 2 dsa c++ exercises on user defined functions
Year 2 dsa  c++ exercises on user defined functionsYear 2 dsa  c++ exercises on user defined functions
Year 2 dsa c++ exercises on user defined functions
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
 
Project 2Project 2.pdfIntroduction to Programming EECS 1.docx
Project 2Project 2.pdfIntroduction to Programming  EECS 1.docxProject 2Project 2.pdfIntroduction to Programming  EECS 1.docx
Project 2Project 2.pdfIntroduction to Programming EECS 1.docx
 
Cpph exam a_2019_s1
Cpph exam a_2019_s1Cpph exam a_2019_s1
Cpph exam a_2019_s1
 
Lec1_EENG112-Introduction.pdf
Lec1_EENG112-Introduction.pdfLec1_EENG112-Introduction.pdf
Lec1_EENG112-Introduction.pdf
 
Important C program of Balagurusamy Book
Important C program of Balagurusamy BookImportant C program of Balagurusamy Book
Important C program of Balagurusamy Book
 
GE3171-PROBLEM SOLVING AND PYTHON PROGRAMMING LABORATORY
GE3171-PROBLEM SOLVING AND PYTHON PROGRAMMING LABORATORYGE3171-PROBLEM SOLVING AND PYTHON PROGRAMMING LABORATORY
GE3171-PROBLEM SOLVING AND PYTHON PROGRAMMING LABORATORY
 
Comp 122 lab 4 lab report and source code
Comp 122 lab 4 lab report and source codeComp 122 lab 4 lab report and source code
Comp 122 lab 4 lab report and source code
 

Recently uploaded

Accounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfAccounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdf
YibeltalNibretu
 

Recently uploaded (20)

Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Advances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdfAdvances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdf
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resources
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptx
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Accounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfAccounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdf
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 

c++ Question

  • 1. BOP Lab Exercise Page 1 Riphah University Faisalabad Lab Exercise BOP Department of Computer Science Muhammad Ali Saeed shk.alisaeed@gmail.com
  • 2. Riphah,FsdCampus BOP Lab Exercise Page 2 Exercise Objectives: C++ Basics INSTRUCTIONS:  Write well-formatted & user-friendly programs.  Create a new (empty) project for each problem.  Submit a word file with your source code each task and screenshot of output  Name the word file in format NAME_ROLL#_CLASS_SECTION  10% penalty for not following the naming rules mentioned in the manual.  Do not use unnecessary variables. Problem(s) / Assignment(s) 1. Create a new (empty) projectin MS Visual Studio as guided to you. Give it a name as follows: BOP_Section_Roll#_Name# 2. Add a new C++ sourcefile in your project. Give it a name as follows: Section_Roll#_Q# 3. Write a C++ statement in your sourcefile to performthe following tasks. NOTE: Write a C++ statement(s) for each of the following task one after the other, in the same order. You have to submitONE word file containing source code and screenshotsof all the tasks. a) Print the message“Hi my name is Ali and and I am CS student ” on one line. b) Printthe message“This is my C++ lab Program” on two lines using two cout statements. The firstline ends at ‘lab’. You have a message“I am fromIslamabad G-11/1”. Display each word of this messageon a new line. 1. Print the message“I am happy in Faisal Abad”. Display each word of this message separated by a tab. Problem1: Cout Statements Estimated completiontime:10mins
  • 3. Riphah,FsdCampus BOP Lab Exercise Page 3 Write a programthat asks the user to enter two numbers, obtains the two numbers from the user and prints the sum, productand difference of the two numbers. You have to write a program to take input of temperature in Fahrenheit and convert it to centigrade it and kelvin. Fahrenheit To Centigrade: 5/9 * (Fahrenheit - 32); ii) Fahrenheit To Kelvin: (5/9 * (Fahrenheit - 32) + 273 ); your output should be like this: ==%%===Temperature Counting of RIPHAH Faisalabad===%%=== Enter Temperature In Farenheit. =====||====Temperature====||===== Temperature in Fahrenheit: Temperature in Centigrade: Temperature in Kelvin: ||-----------------------------------------------------------------------------------------|| Problem4: Use controlled structures like if else Estimated completiontime:10 mins a. Write a program which determines the nature of input of word entered from keyboard.(i.e. an alphabet ‘A’ typed from keyboard would be a Capital letter and ‘4’ is an integer) (HINT: Use ASCII Table) b. Write a program which take three inputs from the user and determine if these could make sides of right triangle or equilateral triangle. Problem2: Variables Estimated completiontime:10mins Problem3: Variables Estimated completiontime:15mins
  • 4. Riphah,FsdCampus BOP Lab Exercise Page 4 The Pythagorean Theorem tells us that the relationship in every right triangle is: a2+b2=c2 Print the following output using for loop? 1 12 123 1234 Up to 10 HINT: Nested Loop may help. THINK . Inputa number fromuser and write a programto print a table of a given number using while loop statement. Write a C++ programto enter an int number from user. Your programdisplay the message“I loveRIPHAH-FSD” as many time as you enter the number and message“FSD is industrialcity” only one time using continue and break statement to control you loop (for,while). For example user enter 3 the programdisplay: Problem5: Use For Loop. Estimated completiontime:10mins Problem6: While Loop Estimated completiontime:15mins Problem7: Estimated completiontime:20mins
  • 5. Riphah,FsdCampus BOP Lab Exercise Page 5 I love RIPHAH-FSD I love RIPHAH-FSD I love RIPHAH-FSD ----------xxxxxx--------- FSD is industrialcity Write a programthat uses do while loops to performthe following steps: a. Promptthe user to input two integers: firstNumand secondNum (firstNummustbe less than secondNum). b. Outputall odd numbers between firstNumand secondNum. c. Outputthe sumof all even numbers between firstNumand secondNum d. Outputthe sumof the squareof the odd numbers between firstNum and secondNum Effective January 1st of each year, Ali receives a 5% raiseon his previous year’s salary. Hewants a programthat calculates and displays the amount of his annual raises for the next three years. Theprogramalso should calculate and display his total salary for the ten years. Write the code to display a table consisting of four rows and six columns. The firstcolumn should contain the numbers 1 through 4 raised to the first power. The second column should contain the result of raising the number in the first column to the second power. The third column should contain the resultof raising the number in the firstcolumn to the third power, and so on. The table will look Problem8: Do while loops or use any loop Estimated completiontime:15mins Problem9: While and do-while loop statements Estimated completiontime:15mins Problem10: Estimated completiontime:20mins
  • 6. Riphah,FsdCampus BOP Lab Exercise Page 6 similar to the one shown in Figure. Use two for statements: one to keep track of the numbers 1 through 4, and the other to keep track of the powers (1 to 6) Use C++ pow function 1 1 1 1 1 1 2 4 8 16 32 64 3 9 27 81 243 729 4 16 64 256 1024 4096 You are done with your exercise(s), make your submission 