0% found this document useful (0 votes)
8 views

C Prog_Lab assignment 3

C programming lab activities

Uploaded by

omsingh300710
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

C Prog_Lab assignment 3

C programming lab activities

Uploaded by

omsingh300710
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

K. K.

Wagh Institute of Engineering Education and Research, Nashik


(Autonomous from Academic Year 2022-23)
F. Y. B. Tech.
Pattern 2022 Semester: I
FYE221010: Programming in C

Assignment No. 03
Title : Understand and implement Iterative algorithmic constructs.

Problem Statement:
After conducting a class test for a course, a teacher wants to record the marks obtained by all the
students in the class and find the Minimum and Maximum score obtained. The teacher is also
interested in knowing the number of students who passed in this test.
Draw a flowchart, write an algorithm/ a pseudo-code and write a C program to record the marks and
perform above functions.

Prerequisites:
Hardware Requirement: Desktop Computer / laptop computer.
Software Requirement: Linux Operating System with GCC
Theory:
 Looping :
 Loop is a mechanism through which you repeatedly execute a set of statements. In
looping, a sequence of statements is executed until some condition for termination of
the loop is satisfied.
 A program loop therefore consists of two segments, one the body of the loop & other
the control statement. The control statement tests certain conditions and then directs
the repeated execution of statements contained in body of the loop.
 Depending on the position of the control statement in the loop, a control structure may
be classified either as entry-controlled loop or exit-controlled loop.
 In entry-controlled loop, the control conditions are tested before start of the execution.
If conditions are not satisfied, then body of the loop will not be executed.
 In exit-controlled loop, the test is performed at the end of the body of the loop and
therefore the body is executed unconditionally for the first time.
 A looping process, in general, would include the following four steps:
1. Setting & Initialization of a counter
2. Execution of the statements in the loop
3. Test for a specified condition for execution of the loop
4. Updating the counter
 The C language provides the following loop constructs:
(a) while statement
(b) do..while statement
(c) for statement
 The WHILE Statement
□ The simplest of all looping structures is the while (an entry-controlled loop) statement.
□The basic format of while statement is Syntax:
 The DO…WHILE Statement

 FOR Loop:

Initialization: Executed only for once just before loop starts. Normally counter
(variable used in loop) is initialized here.
Condition: Is any valid C condition. As long as this is true statement is repeatedly
executed.
Updation: Executed after the statement is executed. Typically contains incrementing
counter or decrementing counter as the case may be.
Statement: (Body of the loop) This is repeatedly executed as long as condition is true. It
may be a compound statement also.
Objectives:

1. To get familiar with the programming using Loop & nested loop Statements.
2. To understand the syntax of for, while and do-while

Problem Analysis:
The problem is to find out the Minimum and Maximum score obtained by the students in the class
and display the count of students who passed in the class test.
The input parameters are marks of each student.
The Output of program is to display Minimum and Maximum score obtained by the students and
count of pass students.

Algorithm/Psuedocode:

Flowchart:

Test case: (Trace loop to check conditions)

Discussion and Conclusion:


By using iterative algorithmic construct, I have performed this lab. Hence, the Minimum and
Maximum score obtained by the students in the class is displayed and Also the number of students
who passed in the class is displayed.

You might also like