SlideShare ist ein Scribd-Unternehmen logo
1 von 2
left0UNIVERSITI TUN HUSSEIN ONN MALAYSIA<br />FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING <br />DTI 2143: COMPUTER PROGRAMMING<br />LAB EXERCISE 4 – MATH.H AND SELECTION intro<br />Exercise 1:<br />Write a program which asks from user for two round numbers and determine which one is larger. The output should similar to:<br /> <br />Exercise 2:<br />FMoving Distance<br />Ξ<br />Write a program which asks the user to enter force, angle and meters of moving distance.<br />Note: W=F*S (W=(F cos Ξ) x s)   sample calculation  25 cos 60 ̊̊ x 8meters. Example of the program output display:<br />Exercise 3:<br />The following well known sequences of numbers are called the Fibonacci sequence:<br />1,1,2,3,5,8,13,21,34

<br />each number in the sequence is the sum of the previous two numbers. The following Binet formula calculates the value of the nth number in the sequence. Using this formula, write a C program to compute and display the 12th number in the Fibonacci sequence.<br />Use pow() and sqrt() from the standard library <math.h><br />Exercise 4:<br />Write a program that converts a period of time specified by user in seconds, to hours, minutes and seconds. Note: there are 60 seconds in a minute and 3600 seconds in an hour<br />Exercise 5: <br />Write a program which asks the user to enter an age, and then displays according to age entered<br />66-++Elderly <br />22-65Adult<br />12-21Teen<br />4-12Kids<br />2-3Toddlers<br />0-1New Born<br />Example of the program output display (user input is in bold):<br />
Dti2143 dam31303 lab sheet 5

Weitere Àhnliche Inhalte

Was ist angesagt?

Alg II 2-7 Transformations
Alg II 2-7 TransformationsAlg II 2-7 Transformations
Alg II 2-7 Transformations
jtentinger
 
test(3)arithmetic in c
test(3)arithmetic in ctest(3)arithmetic in c
test(3)arithmetic in c
Jaya Malathy
 
The monte carlo method
The monte carlo methodThe monte carlo method
The monte carlo method
Saurabh Sood
 
Int alg 3.1 notes
Int alg 3.1 notesInt alg 3.1 notes
Int alg 3.1 notes
Nikki
 
Final project
Final projectFinal project
Final project
alish sha
 
February 24, 2015
February 24, 2015February 24, 2015
February 24, 2015
khyps13
 
Lesson 3.3 3.4 - 1 st and 2nd Derivative Information
Lesson 3.3 3.4 - 1 st and 2nd Derivative InformationLesson 3.3 3.4 - 1 st and 2nd Derivative Information
Lesson 3.3 3.4 - 1 st and 2nd Derivative Information
Sharon Henry
 
Homework graphing
Homework   graphingHomework   graphing
Homework graphing
canyoudiggit
 

Was ist angesagt? (20)

A lab report on modeling and simulation with python code
A lab report on modeling and simulation with python codeA lab report on modeling and simulation with python code
A lab report on modeling and simulation with python code
 
Bsc math previous exam quetions
Bsc math previous exam quetionsBsc math previous exam quetions
Bsc math previous exam quetions
 
Alg II 2-7 Transformations
Alg II 2-7 TransformationsAlg II 2-7 Transformations
Alg II 2-7 Transformations
 
test(3)arithmetic in c
test(3)arithmetic in ctest(3)arithmetic in c
test(3)arithmetic in c
 
Scalable machine learning
Scalable machine learningScalable machine learning
Scalable machine learning
 
The monte carlo method
The monte carlo methodThe monte carlo method
The monte carlo method
 
Core 3 Functions 3
Core 3 Functions 3Core 3 Functions 3
Core 3 Functions 3
 
Core 3 Functions 1
Core 3 Functions 1Core 3 Functions 1
Core 3 Functions 1
 
Quiz 3 (answer)
Quiz 3 (answer)Quiz 3 (answer)
Quiz 3 (answer)
 
State-Space Realizations Using Control Canonical Form and Simulation Diagram
State-Space Realizations Using Control Canonical Form and Simulation DiagramState-Space Realizations Using Control Canonical Form and Simulation Diagram
State-Space Realizations Using Control Canonical Form and Simulation Diagram
 
Int alg 3.1 notes
Int alg 3.1 notesInt alg 3.1 notes
Int alg 3.1 notes
 
Final project
Final projectFinal project
Final project
 
Algorithm for Hungarian Method of Assignment
Algorithm for Hungarian Method of AssignmentAlgorithm for Hungarian Method of Assignment
Algorithm for Hungarian Method of Assignment
 
C- Programming Assignment 3
C- Programming Assignment 3C- Programming Assignment 3
C- Programming Assignment 3
 
February 24, 2015
February 24, 2015February 24, 2015
February 24, 2015
 
Monte Carlo Simulation Methods
Monte Carlo Simulation MethodsMonte Carlo Simulation Methods
Monte Carlo Simulation Methods
 
Lesson 3.3 3.4 - 1 st and 2nd Derivative Information
Lesson 3.3 3.4 - 1 st and 2nd Derivative InformationLesson 3.3 3.4 - 1 st and 2nd Derivative Information
Lesson 3.3 3.4 - 1 st and 2nd Derivative Information
 
Programming qns
Programming qnsProgramming qns
Programming qns
 
Pcd201516
Pcd201516Pcd201516
Pcd201516
 
Homework graphing
Homework   graphingHomework   graphing
Homework graphing
 

Andere mochten auch (8)

Purpose elaborate
Purpose elaboratePurpose elaborate
Purpose elaborate
 
Test 1 alish schema 1
Test 1 alish schema 1Test 1 alish schema 1
Test 1 alish schema 1
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
 
Test 1 skema q&a
Test 1 skema q&aTest 1 skema q&a
Test 1 skema q&a
 
Attn list test
Attn list testAttn list test
Attn list test
 
Dti2143 lab sheet 6
Dti2143 lab sheet 6Dti2143 lab sheet 6
Dti2143 lab sheet 6
 
Lab 9 sem ii_12_13
Lab 9 sem ii_12_13Lab 9 sem ii_12_13
Lab 9 sem ii_12_13
 
What are the causes of conflicts (Bahasa Malaysia)
What are the causes of conflicts (Bahasa Malaysia)What are the causes of conflicts (Bahasa Malaysia)
What are the causes of conflicts (Bahasa Malaysia)
 

Ähnlich wie Dti2143 dam31303 lab sheet 5

Dti2143 lab sheet 4
Dti2143 lab sheet 4Dti2143 lab sheet 4
Dti2143 lab sheet 4
alish sha
 
M166Calculus” ProjectDue Wednesday, December 9, 2015PROJ.docx
M166Calculus” ProjectDue Wednesday, December 9, 2015PROJ.docxM166Calculus” ProjectDue Wednesday, December 9, 2015PROJ.docx
M166Calculus” ProjectDue Wednesday, December 9, 2015PROJ.docx
infantsuk
 
Final project report
Final project reportFinal project report
Final project report
ssuryawanshi
 
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docxJLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
vrickens
 

Ähnlich wie Dti2143 dam31303 lab sheet 5 (20)

Dti2143 lab sheet 4
Dti2143 lab sheet 4Dti2143 lab sheet 4
Dti2143 lab sheet 4
 
DSP_Lab_MAnual_-_Final_Edition[1].docx
DSP_Lab_MAnual_-_Final_Edition[1].docxDSP_Lab_MAnual_-_Final_Edition[1].docx
DSP_Lab_MAnual_-_Final_Edition[1].docx
 
DSP_Lab_MAnual_-_Final_Edition.pdf
DSP_Lab_MAnual_-_Final_Edition.pdfDSP_Lab_MAnual_-_Final_Edition.pdf
DSP_Lab_MAnual_-_Final_Edition.pdf
 
Functions Practice Sheet.docx
Functions Practice Sheet.docxFunctions Practice Sheet.docx
Functions Practice Sheet.docx
 
Cp manual final
Cp manual finalCp manual final
Cp manual final
 
Important C program of Balagurusamy Book
Important C program of Balagurusamy BookImportant C program of Balagurusamy Book
Important C program of Balagurusamy Book
 
M166Calculus” ProjectDue Wednesday, December 9, 2015PROJ.docx
M166Calculus” ProjectDue Wednesday, December 9, 2015PROJ.docxM166Calculus” ProjectDue Wednesday, December 9, 2015PROJ.docx
M166Calculus” ProjectDue Wednesday, December 9, 2015PROJ.docx
 
Mmc manual
Mmc manualMmc manual
Mmc manual
 
Final project report
Final project reportFinal project report
Final project report
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
 
Digital Signal Processing Lab Manual
Digital Signal Processing Lab Manual Digital Signal Processing Lab Manual
Digital Signal Processing Lab Manual
 
Relational Operators in C
Relational Operators in CRelational Operators in C
Relational Operators in C
 
lecture 10 Recursive Function and Macros.ppt
lecture 10 Recursive Function and Macros.pptlecture 10 Recursive Function and Macros.ppt
lecture 10 Recursive Function and Macros.ppt
 
Java conceptual learning material
Java conceptual learning materialJava conceptual learning material
Java conceptual learning material
 
Programming Fundamental handouts
Programming Fundamental handoutsProgramming Fundamental handouts
Programming Fundamental handouts
 
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
 
Python Manuel-R2021.pdf
Python Manuel-R2021.pdfPython Manuel-R2021.pdf
Python Manuel-R2021.pdf
 
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docxJLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
 
Dsp file
Dsp fileDsp file
Dsp file
 
Lecture 7.pptx
Lecture 7.pptxLecture 7.pptx
Lecture 7.pptx
 

Mehr von alish sha (20)

T22016 – how to answer with ubs 9
T22016 – how to answer with ubs 9T22016 – how to answer with ubs 9
T22016 – how to answer with ubs 9
 
July 2014 theory exam (theory)
July 2014 theory exam (theory)July 2014 theory exam (theory)
July 2014 theory exam (theory)
 
Accounting basic equation
Accounting basic equation Accounting basic equation
Accounting basic equation
 
It 302 computerized accounting (week 2) - sharifah
It 302   computerized accounting (week 2) - sharifahIt 302   computerized accounting (week 2) - sharifah
It 302 computerized accounting (week 2) - sharifah
 
It 302 computerized accounting (week 1) - sharifah
It 302   computerized accounting (week 1) - sharifahIt 302   computerized accounting (week 1) - sharifah
It 302 computerized accounting (week 1) - sharifah
 
Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13
 
Lab 6
Lab 6Lab 6
Lab 6
 
Lab 5 2012/2012
Lab 5 2012/2012Lab 5 2012/2012
Lab 5 2012/2012
 
Lab sheet 1
Lab sheet 1Lab sheet 1
Lab sheet 1
 
Lab 6 sem ii_11_12
Lab 6 sem ii_11_12Lab 6 sem ii_11_12
Lab 6 sem ii_11_12
 
Test 1 skema q&a
Test 1 skema q&aTest 1 skema q&a
Test 1 skema q&a
 
Final project
Final projectFinal project
Final project
 
Final project
Final projectFinal project
Final project
 
Carry markdam31303
Carry markdam31303Carry markdam31303
Carry markdam31303
 
Final project
Final projectFinal project
Final project
 
Dti2143 dam31303 lab sheet 8
Dti2143 dam31303 lab sheet 8Dti2143 dam31303 lab sheet 8
Dti2143 dam31303 lab sheet 8
 
Math hquickissential
Math hquickissentialMath hquickissential
Math hquickissential
 
Rpp
RppRpp
Rpp
 
Dam31303 lab sheet 4
Dam31303 lab sheet 4Dam31303 lab sheet 4
Dam31303 lab sheet 4
 
Lab exe 2 dti 2143 dam31303
Lab exe 2 dti 2143 dam31303Lab exe 2 dti 2143 dam31303
Lab exe 2 dti 2143 dam31303
 

KĂŒrzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
Christopher Logan Kennedy
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

KĂŒrzlich hochgeladen (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

Dti2143 dam31303 lab sheet 5

  • 1. left0UNIVERSITI TUN HUSSEIN ONN MALAYSIA<br />FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING <br />DTI 2143: COMPUTER PROGRAMMING<br />LAB EXERCISE 4 – MATH.H AND SELECTION intro<br />Exercise 1:<br />Write a program which asks from user for two round numbers and determine which one is larger. The output should similar to:<br /> <br />Exercise 2:<br />FMoving Distance<br />Ξ<br />Write a program which asks the user to enter force, angle and meters of moving distance.<br />Note: W=F*S (W=(F cos Ξ) x s) sample calculation 25 cos 60 ̊̊ x 8meters. Example of the program output display:<br />Exercise 3:<br />The following well known sequences of numbers are called the Fibonacci sequence:<br />1,1,2,3,5,8,13,21,34

<br />each number in the sequence is the sum of the previous two numbers. The following Binet formula calculates the value of the nth number in the sequence. Using this formula, write a C program to compute and display the 12th number in the Fibonacci sequence.<br />Use pow() and sqrt() from the standard library <math.h><br />Exercise 4:<br />Write a program that converts a period of time specified by user in seconds, to hours, minutes and seconds. Note: there are 60 seconds in a minute and 3600 seconds in an hour<br />Exercise 5: <br />Write a program which asks the user to enter an age, and then displays according to age entered<br />66-++Elderly <br />22-65Adult<br />12-21Teen<br />4-12Kids<br />2-3Toddlers<br />0-1New Born<br />Example of the program output display (user input is in bold):<br />