SlideShare uma empresa Scribd logo
1 de 2
left0UNIVERSITI TUN HUSSEIN ONN MALAYSIA<br />FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING <br />BTI 1022: COMPUTER PROGRAMMING<br />LAB EXERCISE 7 LOOP DESIGN<br />Study the design below<br />For Loopfor (int i = 1; i <= n; i++){   double interest = balance * rate / 100;   balance = balance + interest;}While Loop<br />Exercise 1:<br />Draw a flow chart for:<br />for (int item=0;item<7;item++){<br />    printf(quot;
 Enter price of item: RMquot;
);<br />    scanf(quot;
%lfquot;
, &price);<br />    totalprice +=price;<br />}<br />Exercise 2:<br />Draw a flow chart for:<br />int bil, nilai = 3;<br />for (bil = 5; bil >0; bil--){    <br />         if( bil % 2 == 1)<br />               printf(quot;
 %dquot;
, bil + nilai); <br />   }<br />Exercise 3:<br />Draw a flow chart for:<br />int x = 1;  <br /> while ( x < 10 ) { <br /> printf( quot;
%dquot;
, x );<br />}<br />Exercise 4:<br />Draw a flow chart for:<br />int row,space,star;<br />for(row=1;row<=9;row++)<br />{                     <br />      for(space=8;space>=row;space--)<br />    {<br />       printf(quot;
%cquot;
,288); };<br />           for (star=1;star<row;star++)<br />       {<br />        printf(quot;
* quot;
);  }<br />                       <br />printf(quot;
quot;
);}<br />
Bti1022 lab sheet 8

Mais conteúdo relacionado

Mais procurados

PC 1 continuity
PC 1 continuityPC 1 continuity
PC 1 continuity
vhiggins1
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
Syed Umair
 
Write a program to print out all armstrong numbers between 1 and 500
Write a program to print out all armstrong numbers between 1 and 500Write a program to print out all armstrong numbers between 1 and 500
Write a program to print out all armstrong numbers between 1 and 500
ilsamaryum
 

Mais procurados (14)

Factorial Program in C
Factorial Program in CFactorial Program in C
Factorial Program in C
 
1 (1)
1 (1)1 (1)
1 (1)
 
Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2
 
C- Programming Assignment 3
C- Programming Assignment 3C- Programming Assignment 3
C- Programming Assignment 3
 
C- Programming Assignment practice set 2 solutions
C- Programming Assignment practice set 2 solutionsC- Programming Assignment practice set 2 solutions
C- Programming Assignment practice set 2 solutions
 
PC 1 continuity
PC 1 continuityPC 1 continuity
PC 1 continuity
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solution
 
Operator in c
Operator in cOperator in c
Operator in c
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
 
Operations research
Operations researchOperations research
Operations research
 
MCM FUNCTIONS BLACKBOARD COMPATIBILITY
MCM FUNCTIONS BLACKBOARD COMPATIBILITYMCM FUNCTIONS BLACKBOARD COMPATIBILITY
MCM FUNCTIONS BLACKBOARD COMPATIBILITY
 
BB - Functions (Operations and Piecewise)
BB  - Functions (Operations and Piecewise)BB  - Functions (Operations and Piecewise)
BB - Functions (Operations and Piecewise)
 
Write a program to print out all armstrong numbers between 1 and 500
Write a program to print out all armstrong numbers between 1 and 500Write a program to print out all armstrong numbers between 1 and 500
Write a program to print out all armstrong numbers between 1 and 500
 
Code quailty metrics demystified
Code quailty metrics demystifiedCode quailty metrics demystified
Code quailty metrics demystified
 

Semelhante a Bti1022 lab sheet 8

Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
alish sha
 
Dti2143 lab sheet 6
Dti2143 lab sheet 6Dti2143 lab sheet 6
Dti2143 lab sheet 6
alish sha
 
Dti2143 lab sheet 9
Dti2143 lab sheet 9Dti2143 lab sheet 9
Dti2143 lab sheet 9
alish sha
 
Dti2143 lab sheet 6
Dti2143 lab sheet 6Dti2143 lab sheet 6
Dti2143 lab sheet 6
alish sha
 
Labsheet2 stud
Labsheet2 studLabsheet2 stud
Labsheet2 stud
rohassanie
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
alish sha
 
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
linhtran111111111111
 

Semelhante a Bti1022 lab sheet 8 (20)

Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
 
Dti2143 lab sheet 6
Dti2143 lab sheet 6Dti2143 lab sheet 6
Dti2143 lab sheet 6
 
Dti2143 lab sheet 9
Dti2143 lab sheet 9Dti2143 lab sheet 9
Dti2143 lab sheet 9
 
Lab 1
Lab 1Lab 1
Lab 1
 
C# Loops
C# LoopsC# Loops
C# Loops
 
Arrays
ArraysArrays
Arrays
 
Dti2143 lab sheet 6
Dti2143 lab sheet 6Dti2143 lab sheet 6
Dti2143 lab sheet 6
 
chapter1.ppt
chapter1.pptchapter1.ppt
chapter1.ppt
 
ParallelProgrammingBasics_v2.pdf
ParallelProgrammingBasics_v2.pdfParallelProgrammingBasics_v2.pdf
ParallelProgrammingBasics_v2.pdf
 
Labsheet2 stud
Labsheet2 studLabsheet2 stud
Labsheet2 stud
 
Labsheet2
Labsheet2Labsheet2
Labsheet2
 
chapter1.ppt
chapter1.pptchapter1.ppt
chapter1.ppt
 
chapter1.ppt
chapter1.pptchapter1.ppt
chapter1.ppt
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
 
Develop Embedded Software Module-Session 2
Develop Embedded Software Module-Session 2Develop Embedded Software Module-Session 2
Develop Embedded Software Module-Session 2
 
Basic_analysis.ppt
Basic_analysis.pptBasic_analysis.ppt
Basic_analysis.ppt
 
C# Loops
C# LoopsC# Loops
C# Loops
 
FDS- Basic Concepts.ppt
FDS- Basic Concepts.pptFDS- Basic Concepts.ppt
FDS- Basic Concepts.ppt
 
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
 
Matlab Nn Intro
Matlab Nn IntroMatlab Nn Intro
Matlab Nn Intro
 

Mais de alish sha

Mais de 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
 
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)
 
Lab 9 sem ii_12_13
Lab 9 sem ii_12_13Lab 9 sem ii_12_13
Lab 9 sem ii_12_13
 
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
 
Purpose elaborate
Purpose elaboratePurpose elaborate
Purpose elaborate
 
Lab sheet 1
Lab sheet 1Lab sheet 1
Lab sheet 1
 
Test 1 alish schema 1
Test 1 alish schema 1Test 1 alish schema 1
Test 1 alish schema 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
 
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
 
Attn list test
Attn list testAttn list test
Attn list test
 
Carry markdam31303
Carry markdam31303Carry markdam31303
Carry markdam31303
 

Último

Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 

Último (20)

Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 

Bti1022 lab sheet 8

  • 1. left0UNIVERSITI TUN HUSSEIN ONN MALAYSIA<br />FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING <br />BTI 1022: COMPUTER PROGRAMMING<br />LAB EXERCISE 7 LOOP DESIGN<br />Study the design below<br />For Loopfor (int i = 1; i <= n; i++){   double interest = balance * rate / 100;   balance = balance + interest;}While Loop<br />Exercise 1:<br />Draw a flow chart for:<br />for (int item=0;item<7;item++){<br /> printf(quot; Enter price of item: RMquot; );<br /> scanf(quot; %lfquot; , &price);<br /> totalprice +=price;<br />}<br />Exercise 2:<br />Draw a flow chart for:<br />int bil, nilai = 3;<br />for (bil = 5; bil >0; bil--){ <br /> if( bil % 2 == 1)<br /> printf(quot; %dquot; , bil + nilai); <br /> }<br />Exercise 3:<br />Draw a flow chart for:<br />int x = 1; <br /> while ( x < 10 ) { <br /> printf( quot; %dquot; , x );<br />}<br />Exercise 4:<br />Draw a flow chart for:<br />int row,space,star;<br />for(row=1;row<=9;row++)<br />{ <br /> for(space=8;space>=row;space--)<br /> {<br /> printf(quot; %cquot; ,288); };<br /> for (star=1;star<row;star++)<br /> {<br /> printf(quot; * quot; ); }<br /> <br />printf(quot; quot; );}<br />