Home » Pattern Program 4 in C

Pattern Program 4 in C

Learn about Pattern Program 4 in C in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Contents

Pattern Program 4 in C

Pattern:

  a  a  a  a  a
  b  b  b  b  b
  c  c  c  c  c
  d  d  d  d  d
  e  e  e  e  e

Program:

#include<stdio.h>
int main()
{
   int n;

   printf("Enter number of rows: ");
   scanf("%d",&n);

   for(int r=1; r<=n; r++)
   {
     for(int c=1; c<=n; c++)
     {
       printf("%3c",r+96);
     }
     printf("\n");
   }

   return 0;
}

Output:

Enter number of rows: 5
  a  a  a  a  a
  b  b  b  b  b
  c  c  c  c  c
  d  d  d  d  d
  e  e  e  e  e

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
Pattern Program 3 in C
Pattern Program 2 in C