Lab 6 sem ii_11_12

312 views
248 views

Published on

Lab Sheet 6

Published in: Education, Career
1 Comment
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total views
312
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

Lab 6 sem ii_11_12

  1. 1. UNIVERSITI TUN HUSSEIN ONN MALAYSIA FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING BTI 10202: COMPUTER PROGRAMMING LAB 6: Control Structure –Part 3 NAME : ______________________________________ MARK MATRICS NO.: ____________________ DATE : ________Objective: Students will be able to write C program using combinations of control structuretechnique.Exercise 1:An institute offers a course that prepares students for the licensing exam for real brokers.Last year, several of the students who completed this course took the licensing examination.Naturally, the institute wants to know how well its students did on the exam. You have beenasked to write a program to summarize the results. You have been given a list of these 15students. From the list of result the program should able to segregate between pass and fail.Students with test result between 0-39 will be mark as failed while 40-100 mark as passed.Your program should analyze the results of the exam as follow:1. Input each test result (i.e. 20, 55). Display the message “Enter result <no>” on the screen each time the program requests another test result.2. Display a summary of the test results indicating the number of students who passed and the number of students who failed.3. If more than 6 students failed in the exam, print message “Need teaching improvement!”(Tips: pseudo-code given as following)Declare result as floating numberDeclare and Initialize pass to zeroDeclare and Initialize fail to zeroDeclare and Initialize student counter to oneWhile student counter is less than or equal to fifteen Label reenter Get result If result is smaller and equal to 100 and result is larger and equal to 40 Add one to pass Add one to student counter 1
  2. 2. Else if result is smaller than 40 and result is larger and equal to 0 Add one to fail Add one to student counter Else go to label reenterPrint the number of passPrint the number of fail`If more than 6 students failed Print “Need teaching improvement”Re-write your program: 2

×