Techiio-author
Started by Anik AdhikaryMay 12, 2022

Open
How to write this pattern number using C language ?

4 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 4 VIEWES SHARE

If n=5

then the program will give the below output

1

2 6

3 7 10

4 8 11 13

5 9 12 14 15

1 Replies

Techiio-commentatorSidhdarth Basu replied 10 days ago0 likes0 dislikes
#include<stdio.h>
int main()
{
  int i,j,k;
  for(i=1;i<=5;i++)
  {
    k = i;
    for(j=1;j<=i;j++)
    {
      printf("%d ", k);
      k += 5-j;
    }
    printf("\n");
  }
  return 0;
}
You must be Logged in to reply
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance