0% found this document useful (0 votes)
60 views1 page

Lab 7

This document provides instructions for a programming lab assignment on looping structures in C. It outlines 8 questions to rewrite previous programs using do-while and for loops with input validation. Students are asked to analyze problems, design algorithms, test programs, and include documentation with their name, course, date, and test data. The questions focus on rewriting previous loop examples using different loop structures and validating user input.

Uploaded by

Mohamed Hussein
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views1 page

Lab 7

This document provides instructions for a programming lab assignment on looping structures in C. It outlines 8 questions to rewrite previous programs using do-while and for loops with input validation. Students are asked to analyze problems, design algorithms, test programs, and include documentation with their name, course, date, and test data. The questions focus on rewriting previous loop examples using different loop structures and validating user input.

Uploaded by

Mohamed Hussein
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

CSEB113 Principles of Programming

________________________________________________________________________________

LAB 7: LOOPING PART 2: dowhile AND for LOOP


For each problem below: a) Analyze the problem by identifying input, output, formula, and constraint b) Design an algorithm to solve the problem using pseudocode (so that you could include the pseudocode in your program) c) Prepare several, appropriate number of test data to verify the correctness of your program d) Prepare, compile, link, and execute the program to solve the problem e) Test your program using the prepared test data f) Write proper documentation in the program. Include the following information to form a banner at the beginning of your program:
/****************************************************** * Authors: your name and student ID * * Course: the course code only * * Section: your specific section number * * Date: of lab session * * Brief description: of what problem the * * program tries to solve * * Test data: provide a set of test data * * - input & expected output * ******************************************************/

QUESTIONS 1. Re-write the program of Lab6 Question 2 using do..while loop. 2. Re-write the program of Lab6 Question 2 using for loop. 3. Re-write the program of Lab6 Question 4 using do..while loop. 4. Re-write the program of Lab6 Question 5 using for loop. 5. Re-write the program of Lab6 Question 6 using do..while loop. 6. Improve the program of Lab6 Question 2 (which is supposedly written by implementing a while loop) by implementing proper input data validation. In the new program, using another set of while loop, informs the users should they have entered a wrong input and tells the users to reenter the input. A sample input and output of the program is as follows:
How many times do you want to print the message?: 0 Invalid data. Please re-enter. The value to be entered must be greater than zero How many times do you want to print the message?: 2 Congratulation! You now know how to write a simple C program. Congratulation! You now know how to write a simple C program.

7. Re-write the program in (6) by implementing proper input validation using for loop. 8. Re-write the program in (6) by implementing proper input validation using do..while loop.
-BS-May 2012 1

You might also like