Escolar Documentos
Profissional Documentos
Cultura Documentos
ANDHRA PRADESH
Name of the faculty : G.Padmanabhaiah
Designation : HCME
Branch : Computer Engineering
Institute : V.K.R & V.N.B Polytechnic, Gudivada
Year/Semester : III Semester
Subject : UNIX & C.
Subject Code : CM-304
Topic : Understand repetitive structures.
Duration : 50 Min
Sub Topic : Nested loops.
Teaching Aids : Diagram and animations, PPTs.
CM304.51 1
Objective
Nested loops.
CM304.51 2
Nested loops
CM304.51 3
General form nested loop
CM304.51 4
Nested Loop
CM304.51 5
Simple program using nested loop
#include<stdio.h>
Outer
main() loop
{
int i, j;
for (i=1;i<=5;i++) Inner
{ loop
printf (“\n ”);
for (j=1;j<=i; j++)
{ Output :
1
printf (“%d”, j); 12
} 123
} 1234
12345
CM304.51 6
Summary
CM304.51 7
Quiz
CM304.51 8
Quiz
CM304.51 9
Quiz
2. In the following which one is nested loop?
CM304.51 10
Quiz
2. In the following which one is nested loop?
CM304.51 11
3. What is the output of the following input?
main()
{
int i, j, k;
for (i=1;i<=4;i++)
{
printf (“\n ”);
for (j=1;j<=i; j++)
{
printf (“%d”, j);
} a)1 b) * a) 1
} ** 12
12
123 *** 123
CM304.51 12
3. What is the output of the following input?
main()
{
int i, j, k;
for (i=1;i<=4;i++)
{
printf (“\n ”);
for (j=1;j<=i; j++)
{
printf (“%d”, j);
} a)1 b) * a) 1
} ** 12
12
123 *** 123
CM304.51 13
Frequently Asked Questions
CM304.51 14