Program 284: Program to print Numeric Pattern 4 for consecutive numbers
Pre Explanation:
LOGIC:
Output:
//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:



