• Implement programs using the while, do-while, and for loop statement • Apply break and continue • Construct and use a counter-controlled, sentinel-controlled and flag- controlled repetition structures • Differentiate the various iteration statements from each other and • Implement program using nested loop control structures. Objectives: Description Input N integers(Ask from the user how many nos. he/she wants to input). Determine an print the sum of all nos., the average of all numbers, how many odd nos. were inputted how many even nos. were entered and how many zeroes inputted. Sample Output if Applicable CT Z:\CCS121G4U13382-1\EXER17.EXE Enter desired numbers to input: 6 Input 6 integers: 100 25 12 The Sun of all nos is 132 The Average of all nos is 22.00 Odd nos inputted: 2 Even nos inputted: 2 Zero nos inputted: 2
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
C
Step by step
Solved in 4 steps with 2 images