Example : Write a program in C to print the given pattern using the nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j;
        //clrscr();
	for(i=1;i<=5;i++)
	{
		for(j=1;j<=5;j++)
		{
		    printf(" * ");
		}
		printf("\n");		
	}
       getch();
}
Example : Write a program in C to print as the given pattern using nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j;
        //clrscr();
	for(i=1;i<=5;i++)
	{
		for(j=1;j<=5;j++)
		{
		    printf(" 1 ");
		}
		printf("\n");		
	}
       getch();
}
Example : Write a program in C to print as the given pattern using nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j;
        //clrscr();
	for(i=1;i<=5;i++)
	{
		for(j=1;j<=5;j++)
		{
		    printf(" A ");
		}
		printf("\n");		
	}
       getch();
}
Example : Write a program in C to print as the given pattern using nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j,k=65;
        //clrscr();
	
	for(i=1;i<=5;i++)
	{
		for(j=1;j<=5;j++)
		{
			printf("%c\t",k);
			k=k+1;
		}
		printf("\n");		
	}
        getch();
}
Example : Write a program in C to print as the given pattern using nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j,k=97;
        //clrscr();
	
	for(i=1;i<=5;i++)
	{
		for(j=1;j<=5;j++)
		{
			printf("%c\t",k);
			k=k+1;
		}
		printf("\n");		
	}
        getch();
}
Example : Write a program in C to print as the given pattern using nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j,k=1;
        //clrscr();
	for(i=1;i<=5;i++)
	{
		for(j=1;j<=5;j++)
		{
		    printf(" %d ",k);
		}
		k=k+1;
		printf("\n");		
	}
       getch();
}

--------------------------  OR  --------------------------

#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j;
        //clrscr();
	for(i=1;i<=5;i++)
	{
		for(j=1;j<=5;j++)
		{
		    printf(" %d ",i);
		}		
		printf("\n");		
	}
       getch();
}
Example : Write a program in C to print the given pattern using homogenous & heterogeneous nesting of loop concept.

#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j;
        //clrscr();	
	for(i=1;i<=5;i++)
	{
		for(j=1;j<=5;j++)
		{
		  printf("%d\t",j);            
		}
		printf("\n");		
	}
        getch();
}

-----------------------------  OR  ---------------------------

#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j,k;
        clrscr();
	k=1;
	for(i=1;i<=5;i++)
	{
		j=1;
		while(j<=5)
		{
		  printf("%d\t",k);
		  k=k+1;
                  j++;
		}
		printf("\n");
		k=1;
	}
        getch();
}

  -----------------------------  OR  ---------------------------

#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j;
        //clrscr();	
	for(i=1;i<=5;i++)
	{
		j=1;
		while(j<=5)
		{
		  printf("%d\t",j);			
                  j++;
		}
		printf("\n");		
	}
        getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.

#include<stdio.h>
#include<conio.h>
void main()
{
   int i,j,k=1;
   clrscr();	
   for(i=1;i<=4;i++)
    {
     for(j=1;j<=5;j++)
       {
	  printf("%d  ",k);
	  k=k+1;
       }
       printf("\n");
    }
    getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.

#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j,k;
        //clrscr();
	k=15;
	for(i=1;i<=3;i++)
	{
		for(j=1;j<=5;j++)
		{
		   printf("%d\t",k);
		   k=k-1;
		}
		printf("\n");		
	}
        getch();
}

------------------------------  OR  ------------------------------

#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j,k;
        clrscr();
	k=15;
	for(i=1;i<=3;i++)
	{
		for(j=50;j>=46;j--)
		{
		  printf("%d\t",k);
		  k=k-1;
		}
		printf("\n");		
	}
        getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
  int i,j,k=1;
  //clrscr();
  for(i=1;i<=5;i++)
    {
      for(j=1;j<=i;j++)
        {
          printf("%d  ",k);
        }
        printf("\n");
    }
  getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
  int i,j,k=1;
  //clrscr();
  for(i=1;i<=5;i++)
    {
      for(j=1;j<=i;j++)
        {
          printf("%d  ",k);
        }
        printf("\n");
        k=k+1;
    }
  getch();
}

-----------------------------  OR  ---------------------------

#include<stdio.h>
#include<conio.h>
void main()
{
  int i,j;
  //clrscr();
  for(i=1;i<=5;i++)
    {
      for(j=1;j<=i;j++)
        {
          printf("%d  ",i);
        }
        printf("\n");        
    }
  getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
   int i,j;
   //clrscr();
   for(i=1;i<=5;i++)
    {
       for(j=1;j<=i;j++)
	{
	  printf("%d ",j);
	}
	printf("\n");		
    }
    getch();
}

-----------------------------  OR  ---------------------------

#include<stdio.h>
#include<conio.h>
void main()
{
   int i,j,k;
   //clrscr();
   for(i=1;i<=5;i++)
    {
            k=1;
	   for(j=1;j<=i;j++)
		{
		  printf("%d ",k);
		  k=k+1;
		}
		printf("\n");		
    }
    getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
   int i,j,k=1;
   //clrscr();
   for(i=1;i<=5;i++)
    {
       for(j=1;j<=i;j++)
		{
		  printf("%d ",k);
		  k=k+1;
		}
		printf("\n");				
    }
    getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j;
        clrscr();
	for(i=1;i<=5;i++)
	{
		for(j=5;j>=i;j--)
		{
			printf("%d ",i);
		}
		printf("\n");
	}
	getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j;
        //clrscr();
	for(i=1;i<=5;i++)
	{
	   for(j=5;j>=i;j--)
	     {
		   printf("%d ",j);
	     }
	     printf("\n");		
	}
	getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
	int i,j;
        //clrscr();
	for(i=5;i>=1;i--)
	{
		for(j=1;j<=i;j++)
		{
			printf("%d ",j);
		}
		printf("\n");	
	}
	getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.

#include <stdio.h>
int main() 
{
   int i, j, rows,p=5,k=5;
   printf("Enter the number of rows: ");
   scanf("%d", &rows);
   
   for (i = 1; i <= rows; i++) 
   {
      for (j = 1; j <= p; j++) 
      {
         printf("%d ", k);
         k=k-1;
      }
      printf("\n");
      p=p-1;
      k=5;
   }
   return 0;
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
   int i,j,k,p=4,n=1;
   //clrscr();
   for(i=1;i<=5;i++)
    {
       for(j=1;j<=p;j++)
	{
	   printf(" ");		 	
	}
	   p=p-1;
		
	for(k=1;k<=n;k++)
	{
	   printf("%d",k);		 	
	}
           n=n+1;
		 
	printf("\n");					
    }
    
    getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
   int i,j,k,p=4,n=1;
   //clrscr();
   for(i=1;i<=5;i++)
    {
       for(j=1;j<=p;j++)
	{
	   printf(" ");		 	
	}
	p=p-1;
		
	for(k=n;k>=1;k--)
	{
	   printf("%d",k);		   		 	
	}
	n=n+1;
		 
	printf("\n");						
    }
    
    getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
   int i,j,k,p=4,n=5;
   //clrscr();
   for(i=1;i<=5;i++)
    {
       for(j=1;j<=p;j++)
	{
	   printf(" ");		 	
	}
	   p=p-1;
		
	for(k=5;k>=n;k--)
	{
	   printf("%d",k);
		   		 	
	}
	   n=n-1;		 
	printf("\n");						
    }
    
    getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.
#include<stdio.h>
#include<conio.h>
void main()
{
   int i,j,k,p=4,n=5;
   //clrscr();
   for(i=1;i<=5;i++)
    {
       for(j=1;j<=p;j++)
	{
	   printf(" ");		 	
	}
	   p=p-1;
		
       for(k=n;k<=5;k++)
	{
	   printf("%d",k);
		   		 	
	}
	   n=n-1;		 
	printf("\n");						
    }    
    getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.

#include<stdio.h>
#include<conio.h>
void main()
{
   int i,j,k=1,p=2;
   //clrscr();	
   for(i=1;i<=4;i++)
    {
     for(j=1;j<=5;j++)
       {
	  if(i%2!=0)
	   {
	       	printf("%d ",k);
		k=k+2;		
	   }
	  else
	   {
		printf("%d  ",p);
		p=p+2;	
	   }	  
       }
      printf("\n");
    }
    getch();
}
Example : Write a program in C to print the given pattern using the nesting of loop concept.

#include<stdio.h>
#include<conio.h>
int main()
{
    int i, j, k, rows;
    printf("Enter the value for rows: ");
    scanf("%d", &rows); 
    
    // printing Upper part
	for (i = 1; i <= rows; i++) 
	{
        for (j = 1; j <= i; j++)
        {
           printf("%d", i);	
	}            
      printf("\n");
    }
 
    // printing lower part
    for (i = rows; i > 0; i--) 
	{
        for (j = i; j > 0; j--)
        {
           printf("%d", i);	
	}            
      printf("\n");
    }
    return 0;
}

-------------  OR  --------------

#include<stdio.h>
#include<conio.h>
int main()
{
    int i, j, k, rows;
    printf("Enter the value for rows: ");
    scanf("%d", &rows); 
    
    // printing Upper part
	for (i = 1; i <= rows; i++) 
	{
        for (j = 1; j <= i; j++)
        {
           printf("%d", i);	
	}            
      printf("\n");
    }
 
    // printing lower part
    for (i = rows-1; i > 0; i--) 
	{
        for (j = i; j > 0; j--)
        {
           printf("%d", i);	
	}            
      printf("\n");
    }
    return 0;
}
Example : Write a program in C to print the given pattern (Pyramid Shape) using the nesting of loop concept.

#include<stdio.h>
#include<conio.h>
int main()
{
    int i, j, k, rows;
    printf("Enter the value for rows: ");
    scanf("%d", &rows); 
    
    for (i = 1; i <= rows; i++) 
	{        
           for (j = 1; j <= 2 * (rows - i); j++) 
	    {
               printf(" ");
            } 
        
           for (k = 1; k < 2 * i; k++) 
	    {               
               printf("* ");
            }
          printf("\n");
        }
    return 0;
}
Example : Write a program in C to print the given pattern (Hollow Pyramid Shape) using the nesting of loop concept.

#include <stdio.h>
 
int main() 
{
    int i, j, k, n = 7;
 
    for (i = 1; i <= n; i++) 
	{
        // Codes for printing leading spaces
        for (j = i; j < n; j++) 
		{
            printf(" ");
        }
 
        // Codes for printing asterisks symbols
        for (k = 1; k <= 2 * i - 1; k++) 
		{
            if (k == 1 || k == 2 * i - 1 || i == n) 
			{
                printf("*");
            } 
			else
			{
                printf(" ");
            }
        } 
        
        printf("\n");
    } 
    return 0;
}
Example : Write a program in C to print the given pattern (Diamond Shape) using the nesting of loop concept.

#include<stdio.h>
#include<conio.h>
int main()
{
   int i, j, k, n = 5;
 
    // Show the top part of pyramid
    for (i = 1; i <= n; i++) 
	{
        for (j = 1; j <= n - i; j++) 
	{
            printf(" ");
        }
        
        for (k = 1; k <= 2 * i - 1; k++) 
	{
            printf("*");
        }
        printf("\n");
    }
 
    // Show the bottom inverted part of pyramid
    for (i = n - 1; i >= 1; i--) 
	{
        for (j = 1; j <= n - i; j++) 
	{
            printf(" ");
        }
        
        for (k = 1; k <= 2 * i - 1; k++) 
	{
            printf("*");
        }
        printf("\n");
    }
    return 0;
}

Loading

Categories: C

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.