Contact Learn C
Copy

Program 284: Program to print Numeric Pattern 4 for consecutive numbers

Program 284: Program to print Numeric Pattern 4 for consecutive numbers

//1
//2 6  
//3 7  10
//4 8  11  13
//5 9  12  14 15
//For 5 rows
#include<stdio.h>
main()
{
 int i,rows,difference,k,j;
 printf("Enter Number of rows\n");
 scanf("%d",&rows);
 for(i=1;i<=rows;i++)
 {
     difference=rows-1;
     k=i;
  for(j=1;j<=i;j++)
  {
   printf("%d ",k);
   k+=difference;
   difference--;
  }
  printf("\n");
 }
 
}
Explanation:

Pre Explanation:
LOGIC:


Output:
Program to print Numeric Pattern 4 for consecutive numbers


Donate

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide