SlideShare a Scribd company logo
1 of 4
left0UNIVERSITI TUN HUSSEIN ONN MALAYSIA<br />FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING <br />DTI 2143: COMPUTER PROGRAMMING<br />LAB EXERCISE 8 ARRAY<br />Exercise 1.0:  Compile and run the program below<br />#include<stdio.h><br />#include<conio.h><br />int main(){<br />int i, mark[10], j=0;<br />printf(quot;
Insert 10 Marksquot;
);<br />for(i=0;i<10;i++)<br />{     scanf(quot;
%dquot;
,&mark[i]);<br />      if(mark[i]>=50)<br />      j++;     }<br />  <br />printf(quot;
 Total of students passed:%dquot;
,j);<br />getch();<br />return 0;  <br />}<br />,[object Object]
 Reprogram the coding above  to calculate
Total
AverageExercise 2.0:  Compile and run the program below<br />#include<stdio.h><br />#include<conio.h><br />int main(){<br />int i,j;<br />float b[3][4]={1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,10.1,11.1,12.1};<br />for(i=0;i<3;i++)<br />{<br />      for(j=0;j<4;j++)<br />      {<br />          printf(quot;
[%d][%d]=%.1fquot;
,i,j,b[i][j]);               <br />      }    <br />}<br />getch();<br />return 0;  <br />}<br />,[object Object]

More Related Content

What's hot

Webinar PHParty7 - Errors handlings
Webinar PHParty7 - Errors handlingsWebinar PHParty7 - Errors handlings
Webinar PHParty7 - Errors handlingsDarkmira
 
C programing basic input and output
C  programing basic input and outputC  programing basic input and output
C programing basic input and outputdhanajeyan dhanaj
 
SPL 10.1 | Manual Tracing on Basic Loop & 1D Array
SPL 10.1 | Manual Tracing on Basic Loop & 1D ArraySPL 10.1 | Manual Tracing on Basic Loop & 1D Array
SPL 10.1 | Manual Tracing on Basic Loop & 1D ArrayMohammad Imam Hossain
 
C Programing Solve Presentation -CSE
C Programing Solve Presentation -CSEC Programing Solve Presentation -CSE
C Programing Solve Presentation -CSEsalman ahmed
 
C programming BY Mazedur
C programming BY MazedurC programming BY Mazedur
C programming BY MazedurMazedurr rahman
 
Palindrome number program c
Palindrome number program cPalindrome number program c
Palindrome number program cmohdshanu
 
C program to check leap year
C program to check leap year C program to check leap year
C program to check leap year mohdshanu
 
Bti1022 lab sheet 7
Bti1022 lab sheet 7Bti1022 lab sheet 7
Bti1022 lab sheet 7alish sha
 

What's hot (13)

Webinar PHParty7 - Errors handlings
Webinar PHParty7 - Errors handlingsWebinar PHParty7 - Errors handlings
Webinar PHParty7 - Errors handlings
 
Test2
Test2Test2
Test2
 
C programing basic input and output
C  programing basic input and outputC  programing basic input and output
C programing basic input and output
 
SPL 10.1 | Manual Tracing on Basic Loop & 1D Array
SPL 10.1 | Manual Tracing on Basic Loop & 1D ArraySPL 10.1 | Manual Tracing on Basic Loop & 1D Array
SPL 10.1 | Manual Tracing on Basic Loop & 1D Array
 
JavaScript Gotchas
JavaScript GotchasJavaScript Gotchas
JavaScript Gotchas
 
C Programing Solve Presentation -CSE
C Programing Solve Presentation -CSEC Programing Solve Presentation -CSE
C Programing Solve Presentation -CSE
 
Aggregate
AggregateAggregate
Aggregate
 
C programming BY Mazedur
C programming BY MazedurC programming BY Mazedur
C programming BY Mazedur
 
Palindrome number program c
Palindrome number program cPalindrome number program c
Palindrome number program c
 
Programa2
Programa2Programa2
Programa2
 
Program presentation
Program presentationProgram presentation
Program presentation
 
C program to check leap year
C program to check leap year C program to check leap year
C program to check leap year
 
Bti1022 lab sheet 7
Bti1022 lab sheet 7Bti1022 lab sheet 7
Bti1022 lab sheet 7
 

Viewers also liked

Metabolismo agueda
Metabolismo aguedaMetabolismo agueda
Metabolismo aguedajuanapardo
 
Câu chuyệ sức khoẻ 21
Câu chuyệ sức khoẻ 21Câu chuyệ sức khoẻ 21
Câu chuyệ sức khoẻ 21vinhtungdk
 
15waystobehappierqnet 130925034933-phpapp02
15waystobehappierqnet 130925034933-phpapp0215waystobehappierqnet 130925034933-phpapp02
15waystobehappierqnet 130925034933-phpapp02Nicky Yin
 
2012 Salary Report
2012 Salary Report2012 Salary Report
2012 Salary Reportlelandb01
 
การนำเสนอ..
การนำเสนอ..การนำเสนอ..
การนำเสนอ..NattAA
 
โครงงานครั้งที่ 2 (Guava Cake)
โครงงานครั้งที่ 2 (Guava Cake)โครงงานครั้งที่ 2 (Guava Cake)
โครงงานครั้งที่ 2 (Guava Cake)NattAA
 
Ways of looking 2
Ways of looking 2Ways of looking 2
Ways of looking 2amandakane1
 
Publicidade non sexista
Publicidade non sexistaPublicidade non sexista
Publicidade non sexistajuanapardo
 
How to Upload a List From Excel to InfusionSoft
How to Upload a List From Excel to InfusionSoftHow to Upload a List From Excel to InfusionSoft
How to Upload a List From Excel to InfusionSoftMarvin Libron
 
データセンターコンファレンス2014Spring_Niscom
データセンターコンファレンス2014Spring_Niscomデータセンターコンファレンス2014Spring_Niscom
データセンターコンファレンス2014Spring_NiscomTakeshi Mitsuishi
 
How to manage your home improvement projects
How to manage your home improvement projectsHow to manage your home improvement projects
How to manage your home improvement projectsHomeZada
 
Bti1022 lab sheet 3
Bti1022 lab sheet 3Bti1022 lab sheet 3
Bti1022 lab sheet 3alish sha
 
Design Engage Program - An Overview
Design Engage Program - An OverviewDesign Engage Program - An Overview
Design Engage Program - An OverviewCloud View Pte Ltd
 
Assistive technology web_quest_vicki_dowse
Assistive technology web_quest_vicki_dowseAssistive technology web_quest_vicki_dowse
Assistive technology web_quest_vicki_dowsevdowse
 

Viewers also liked (20)

ΠΑΡΟΥΣΙΑΣΗ Ecomobility 2015
ΠΑΡΟΥΣΙΑΣΗ   Ecomobility     2015ΠΑΡΟΥΣΙΑΣΗ   Ecomobility     2015
ΠΑΡΟΥΣΙΑΣΗ Ecomobility 2015
 
33 microorg
33 microorg33 microorg
33 microorg
 
Metabolismo agueda
Metabolismo aguedaMetabolismo agueda
Metabolismo agueda
 
Câu chuyệ sức khoẻ 21
Câu chuyệ sức khoẻ 21Câu chuyệ sức khoẻ 21
Câu chuyệ sức khoẻ 21
 
Why Choose Us
Why Choose UsWhy Choose Us
Why Choose Us
 
15waystobehappierqnet 130925034933-phpapp02
15waystobehappierqnet 130925034933-phpapp0215waystobehappierqnet 130925034933-phpapp02
15waystobehappierqnet 130925034933-phpapp02
 
2012 Salary Report
2012 Salary Report2012 Salary Report
2012 Salary Report
 
การนำเสนอ..
การนำเสนอ..การนำเสนอ..
การนำเสนอ..
 
โครงงานครั้งที่ 2 (Guava Cake)
โครงงานครั้งที่ 2 (Guava Cake)โครงงานครั้งที่ 2 (Guava Cake)
โครงงานครั้งที่ 2 (Guava Cake)
 
Ways of looking 2
Ways of looking 2Ways of looking 2
Ways of looking 2
 
Test1
Test1Test1
Test1
 
Publicidade non sexista
Publicidade non sexistaPublicidade non sexista
Publicidade non sexista
 
How to Upload a List From Excel to InfusionSoft
How to Upload a List From Excel to InfusionSoftHow to Upload a List From Excel to InfusionSoft
How to Upload a List From Excel to InfusionSoft
 
Tema 2 cmc
Tema 2 cmcTema 2 cmc
Tema 2 cmc
 
データセンターコンファレンス2014Spring_Niscom
データセンターコンファレンス2014Spring_Niscomデータセンターコンファレンス2014Spring_Niscom
データセンターコンファレンス2014Spring_Niscom
 
How to manage your home improvement projects
How to manage your home improvement projectsHow to manage your home improvement projects
How to manage your home improvement projects
 
Bti1022 lab sheet 3
Bti1022 lab sheet 3Bti1022 lab sheet 3
Bti1022 lab sheet 3
 
Takethetime
TakethetimeTakethetime
Takethetime
 
Design Engage Program - An Overview
Design Engage Program - An OverviewDesign Engage Program - An Overview
Design Engage Program - An Overview
 
Assistive technology web_quest_vicki_dowse
Assistive technology web_quest_vicki_dowseAssistive technology web_quest_vicki_dowse
Assistive technology web_quest_vicki_dowse
 

Similar to Dti2143 lab sheet 8

Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8alish sha
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7alish sha
 
Dti2143 lab sheet 9
Dti2143 lab sheet 9Dti2143 lab sheet 9
Dti2143 lab sheet 9alish sha
 
Dti2143 dam31303 lab sheet 8
Dti2143 dam31303 lab sheet 8Dti2143 dam31303 lab sheet 8
Dti2143 dam31303 lab sheet 8alish sha
 
Wildlife conservation project management adri jovin
Wildlife conservation project management  adri jovinWildlife conservation project management  adri jovin
Wildlife conservation project management adri jovinAdri Jovin
 
Core programming in c
Core programming in cCore programming in c
Core programming in cRahul Pandit
 
Dti2143 lab sheet 6
Dti2143 lab sheet 6Dti2143 lab sheet 6
Dti2143 lab sheet 6alish sha
 
Dti2143 lab sheet 7
Dti2143 lab sheet 7Dti2143 lab sheet 7
Dti2143 lab sheet 7alish sha
 
Here is the grading matrix where the TA will leave feedback. If you .docx
Here is the grading matrix where the TA will leave feedback. If you .docxHere is the grading matrix where the TA will leave feedback. If you .docx
Here is the grading matrix where the TA will leave feedback. If you .docxtrappiteboni
 
Network lap pgms 7th semester
Network lap pgms 7th semesterNetwork lap pgms 7th semester
Network lap pgms 7th semesterDOSONKA Group
 
E1 – FundamentalsPlease refer to announcements for details about.docx
E1 – FundamentalsPlease refer to announcements for details about.docxE1 – FundamentalsPlease refer to announcements for details about.docx
E1 – FundamentalsPlease refer to announcements for details about.docxjacksnathalie
 
Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207Syed Tanveer
 
4 operators, expressions &amp; statements
4  operators, expressions &amp; statements4  operators, expressions &amp; statements
4 operators, expressions &amp; statementsMomenMostafa
 
C basics
C basicsC basics
C basicsMSc CST
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solutionyogini sharma
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans incnayakq
 

Similar to Dti2143 lab sheet 8 (20)

Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
 
Dti2143 lab sheet 9
Dti2143 lab sheet 9Dti2143 lab sheet 9
Dti2143 lab sheet 9
 
C file
C fileC file
C file
 
C language program
C language programC language program
C language program
 
Dti2143 dam31303 lab sheet 8
Dti2143 dam31303 lab sheet 8Dti2143 dam31303 lab sheet 8
Dti2143 dam31303 lab sheet 8
 
Wildlife conservation project management adri jovin
Wildlife conservation project management  adri jovinWildlife conservation project management  adri jovin
Wildlife conservation project management adri jovin
 
Core programming in c
Core programming in cCore programming in c
Core programming in c
 
Dti2143 lab sheet 6
Dti2143 lab sheet 6Dti2143 lab sheet 6
Dti2143 lab sheet 6
 
Dti2143 lab sheet 7
Dti2143 lab sheet 7Dti2143 lab sheet 7
Dti2143 lab sheet 7
 
Here is the grading matrix where the TA will leave feedback. If you .docx
Here is the grading matrix where the TA will leave feedback. If you .docxHere is the grading matrix where the TA will leave feedback. If you .docx
Here is the grading matrix where the TA will leave feedback. If you .docx
 
Network lap pgms 7th semester
Network lap pgms 7th semesterNetwork lap pgms 7th semester
Network lap pgms 7th semester
 
C
CC
C
 
E1 – FundamentalsPlease refer to announcements for details about.docx
E1 – FundamentalsPlease refer to announcements for details about.docxE1 – FundamentalsPlease refer to announcements for details about.docx
E1 – FundamentalsPlease refer to announcements for details about.docx
 
Spiral array
Spiral arraySpiral array
Spiral array
 
Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207
 
4 operators, expressions &amp; statements
4  operators, expressions &amp; statements4  operators, expressions &amp; statements
4 operators, expressions &amp; statements
 
C basics
C basicsC basics
C basics
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solution
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
 

More from alish sha

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 9alish sha
 
July 2014 theory exam (theory)
July 2014 theory exam (theory)July 2014 theory exam (theory)
July 2014 theory exam (theory)alish sha
 
Accounting basic equation
Accounting basic equation Accounting basic equation
Accounting basic equation alish sha
 
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) - sharifahalish sha
 
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) - sharifahalish sha
 
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)alish sha
 
Lab 9 sem ii_12_13
Lab 9 sem ii_12_13Lab 9 sem ii_12_13
Lab 9 sem ii_12_13alish sha
 
Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13alish sha
 
Lab 5 2012/2012
Lab 5 2012/2012Lab 5 2012/2012
Lab 5 2012/2012alish sha
 
Purpose elaborate
Purpose elaboratePurpose elaborate
Purpose elaboratealish sha
 
Test 1 alish schema 1
Test 1 alish schema 1Test 1 alish schema 1
Test 1 alish schema 1alish sha
 
Lab 6 sem ii_11_12
Lab 6 sem ii_11_12Lab 6 sem ii_11_12
Lab 6 sem ii_11_12alish sha
 
Test 1 skema q&a
Test 1 skema q&aTest 1 skema q&a
Test 1 skema q&aalish sha
 
Test 1 skema q&a
Test 1 skema q&aTest 1 skema q&a
Test 1 skema q&aalish sha
 
Final project
Final projectFinal project
Final projectalish sha
 
Final project
Final projectFinal project
Final projectalish sha
 
Attn list test
Attn list testAttn list test
Attn list testalish sha
 
Carry markdam31303
Carry markdam31303Carry markdam31303
Carry markdam31303alish sha
 

More from 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
 

Dti2143 lab sheet 8

  • 1.
  • 2. Reprogram the coding above to calculate
  • 4.
  • 8. Exercise 3: Compile and run the program below#include<stdio.h><br />#include<conio.h><br />char matrik[20],nama[50];<br />float kiratotal(float x, float y, float z){<br /> float a;<br /> a=x+y+z;<br /> return a;<br /> }<br />float kirapurata(float b){<br /> <br /> return (b/3);<br /> }<br /> <br /> <br />int display (float total, float average){<br />printf(quot; =========================quot; );<br />printf(quot; STUDENT'S RESULTquot; );<br />printf(quot; =========================quot; );<br /> printf(quot; name:%squot; ,nama);<br /> printf(quot; matrix number:%squot; ,matrik);<br /> printf(quot; total:%.2fquot; ,total);<br /> printf(quot; average:%.2fquot; ,average);<br /> <br /> if (average<=100 && average>=80)<br /> { printf(quot; grade:Aquot; ,average); }<br /> else if (average<=79 && average>=60)<br /> { printf(quot; grade:Bquot; ,average); }<br /> else if (average<=59 && average>=40)<br /> { printf(quot; grade:cquot; ,average); }<br /> else if (average<=39 && average>=20)<br /> { printf(quot; grade:Dquot; ,average); }<br /> else if (average<=19 && average>=0)<br /> { printf(quot; grade:Equot; ,average);} <br />}<br />int main()<br />{<br />float total,average,test,assign,final;<br />char ulang='y';<br />while (ulang=='y')<br />{<br />printf(quot; Enter student informationquot; );<br />printf(quot; ----------------------------quot; );<br />printf(quot; Matrik No. : quot; ); scanf(quot; %squot; ,&matrik);<br />printf(quot; Name : quot; ); scanf(quot; %squot; ,&nama);<br />printf(quot; Test Mark : quot; ); scanf(quot; %fquot; ,&test);<br />printf(quot; Assignment Mark : quot; ); scanf(quot; %fquot; ,&assign);<br />printf(quot; Final Exam Mark : quot; ); scanf(quot; %fquot; ,&final);<br />total= kiratotal(test, assign, final);<br />average= kirapurata(total);<br />display(total,average);<br /> printf(quot; =========================quot; ); <br /> printf (quot; Do you want to proceed? Enter 'y' for yes or else for no : quot; );<br /> scanf (quot; %squot; ,&ulang);<br /> printf (quot; quot; );<br />}<br />getch();<br />return 0;<br />}<br />3.1 Modify the coding above to get input and output from user in a sub function called getio()<br />