program to print given number pattern

Write a c program to print given number pattern
1
2 6
3 7 10
4 8 11 13
5 9 12 14 15

#include<stdio.h>
int main()
{
  int i,m,n;
  for(i=1;i<=5;i++)
  {
    n = i;
    for(m=1;m<=i;m++)
    {
      printf("%d ", n);
      n += 5-m;
    }
    printf("\n");
  }
}

Related Posts