SlideShare a Scribd company logo
3
Most read
5
Most read
13
Most read
	Presentationnested loopsBy:- Balwinder Singh
     contentsWhat is a Loop?
Nested While loops.
Do…..While loops.
Nested For loops.
Question.     What is a loop?A loop is a programming structure that contains an executable block of code that repeats so long as a given condition is true/not true.
Good programmers include a way to satisfy the condition somewhere inside the executable block.loops
     Types of nested loopsNested While Loops.
Do…..While Loops.
Nested For Loops.nested loops
      Nested while loopsWHILE loops may be nested, that is you can put a WHILE loop inside another WHILE loop.
 However, one must start the inner loop after starting the outer loop and end the inner loop before ending the outer loop for a logically correct nesting.      Example:- nested while loopsTo print the following series:-11   21   2   31   2   3   41   2   3   4   5
      Example:- nested while loops#include<stdio.h>#include<conio.h>main(){ int r=1,c=1;	while (r<=5)	{		c=1;		while(c<=r)		{printf(“%d”,c);c++;		      }printf(“\n”);		r++;		}getch();}
Do……while loopExecutes the loop statement once and then repeats the loop statement until the condition is zero (false).

More Related Content

PDF
Introduction to oops concepts
PPTX
Types of loops in c language
PPTX
Nested loops
PDF
10. switch case
PPT
Looping statements in Java
PPTX
Interfaces in java
PPTX
Python-Inheritance.pptx
PDF
Function overloading ppt
Introduction to oops concepts
Types of loops in c language
Nested loops
10. switch case
Looping statements in Java
Interfaces in java
Python-Inheritance.pptx
Function overloading ppt

What's hot (20)

PPT
File handling in c
PPTX
Bootstrap 4 ppt
PDF
Python final ppt
PPTX
Type casting in java
PPTX
python project ppt.pptx
PPT
Strings
PPT
Array in c
PPTX
Loop(for, while, do while) condition Presentation
PPTX
The Loops
PPTX
Inheritance in java
PPTX
While , For , Do-While Loop
PDF
Strings in java
PPTX
stack & queue
PPTX
PPTX
Features of java
PPT
PPTX
C language ppt
PPTX
Method overloading
PPTX
Looping (Computer programming and utilization)
File handling in c
Bootstrap 4 ppt
Python final ppt
Type casting in java
python project ppt.pptx
Strings
Array in c
Loop(for, while, do while) condition Presentation
The Loops
Inheritance in java
While , For , Do-While Loop
Strings in java
stack & queue
Features of java
C language ppt
Method overloading
Looping (Computer programming and utilization)
Ad

Viewers also liked (20)

PPTX
Loops c++
PPTX
Loops in C Programming
PPTX
C++ loop
PPTX
Do While and While Loop
PPTX
Loops Basics
PPTX
Loops in C
PPTX
PPSX
INTRODUCTION TO C PROGRAMMING
PPT
Basics of c++ Programming Language
PPTX
Loops in R
PDF
Two-Stage Approach for Nesting in Two-dimensional Cutting Problems Using
PDF
Amy Grace Wells: Nesting Content Strategy
PDF
c++ for loops
PDF
Understanding the Nesting Structure of the Ember.js View Layer
PDF
Loops and conditional statements
PPTX
C# Loops
PDF
Getting SASSy with front end development
PPT
Fundamentals of programming finals.ajang
Loops c++
Loops in C Programming
C++ loop
Do While and While Loop
Loops Basics
Loops in C
INTRODUCTION TO C PROGRAMMING
Basics of c++ Programming Language
Loops in R
Two-Stage Approach for Nesting in Two-dimensional Cutting Problems Using
Amy Grace Wells: Nesting Content Strategy
c++ for loops
Understanding the Nesting Structure of the Ember.js View Layer
Loops and conditional statements
C# Loops
Getting SASSy with front end development
Fundamentals of programming finals.ajang
Ad

Similar to Presentation on nesting of loops (20)

PDF
presentationonnestingofloops-110228071935-phpapp01.pdf
PPTX
Nested Loops in C.pptx
PPTX
Loops in c
PDF
loops in C ppt.pdf
PPTX
Loop structures
PPTX
Cse lecture-7-c loop
PPT
Chapter06.PPT
PDF
LOOP STATEMENTS AND TYPES OF LOOP IN C LANGUAGE BY RIZWAN
PPTX
Decision Making and Looping
PPT
12 lec 12 loop
PPTX
PPTX
Loop (Computer programming and utilization)
PDF
Loop and while Loop
PPTX
C Programming Language Part 6
PPTX
C program language tutorial for loop while loop do while loop
PPTX
Loops in c language
PPTX
Loops in c language
PPT
Mesics lecture 7 iteration and repetitive executions
PPSX
Nested loops
presentationonnestingofloops-110228071935-phpapp01.pdf
Nested Loops in C.pptx
Loops in c
loops in C ppt.pdf
Loop structures
Cse lecture-7-c loop
Chapter06.PPT
LOOP STATEMENTS AND TYPES OF LOOP IN C LANGUAGE BY RIZWAN
Decision Making and Looping
12 lec 12 loop
Loop (Computer programming and utilization)
Loop and while Loop
C Programming Language Part 6
C program language tutorial for loop while loop do while loop
Loops in c language
Loops in c language
Mesics lecture 7 iteration and repetitive executions
Nested loops

Recently uploaded (20)

PDF
Module 3: Health Systems Tutorial Slides S2 2025
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
PDF
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
PDF
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
From loneliness to social connection charting
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
O7-L3 Supply Chain Operations - ICLT Program
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
PDF
English Language Teaching from Post-.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
Module 3: Health Systems Tutorial Slides S2 2025
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Cardiovascular Pharmacology for pharmacy students.pptx
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
From loneliness to social connection charting
102 student loan defaulters named and shamed – Is someone you know on the list?
O7-L3 Supply Chain Operations - ICLT Program
UPPER GASTRO INTESTINAL DISORDER.docx
Abdominal Access Techniques with Prof. Dr. R K Mishra
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
human mycosis Human fungal infections are called human mycosis..pptx
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
English Language Teaching from Post-.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx

Presentation on nesting of loops

  • 2. contentsWhat is a Loop?
  • 6. Question. What is a loop?A loop is a programming structure that contains an executable block of code that repeats so long as a given condition is true/not true.
  • 7. Good programmers include a way to satisfy the condition somewhere inside the executable block.loops
  • 8. Types of nested loopsNested While Loops.
  • 11. Nested while loopsWHILE loops may be nested, that is you can put a WHILE loop inside another WHILE loop.
  • 12. However, one must start the inner loop after starting the outer loop and end the inner loop before ending the outer loop for a logically correct nesting. Example:- nested while loopsTo print the following series:-11 21 2 31 2 3 41 2 3 4 5
  • 13. Example:- nested while loops#include<stdio.h>#include<conio.h>main(){ int r=1,c=1; while (r<=5) { c=1; while(c<=r) {printf(“%d”,c);c++; }printf(“\n”); r++; }getch();}
  • 14. Do……while loopExecutes the loop statement once and then repeats the loop statement until the condition is zero (false).
  • 15. Starts with a do statement and then tests the repetition condition in the while statement at the end of the loop. Syntax:- do { statements; } while(condition);
  • 17. Example:- do….While loop Accept any number from the user to print the number is positive or negative.#include<stdio.h>#include<conio.h>main(){ int a;do {printf(“Enter any number”);scanf(“%”,&a);if (a>=0)printf(“Number is positive”);elseprintf(“Number is Negative”); }while(a!=0);getch();}
  • 18. Nested for loopsA for loop can contain any kind of statement in its body, including another for loop.
  • 19. The inner loop should have a different name for its loop counter variable so that it will not conflict with the outer loop. Example:- nested forloopsWrite a program to print the following series:- 1 2 3 4 5 6 7 8 9 10
  • 20. Example:- nested for loops#include<stdio.h>#include<conio.h>main(){ intr,c,k=1; for (r=1;r<=4;r++) { for (c=1;c<=r; c++) {printf(“%d”,k); k++; }printf(“\n”); }getch();}