Skip to content

Instantly share code, notes, and snippets.

@Harshapriya123
Created April 23, 2019 05:36
Show Gist options
  • Save Harshapriya123/31407ff1a81671f2ac97c97330fd9b0d to your computer and use it in GitHub Desktop.
Save Harshapriya123/31407ff1a81671f2ac97c97330fd9b0d to your computer and use it in GitHub Desktop.
How to print the following in c language?
1. How to print the following in c language?
n=5
o/p
0
1 0
2 1 0
3 2 1 0
4 3 2 1 0
2. How to print the following in c language?
n=5
2
3 4
4 5 6
5 6 7 8
6 7 8 9 10
@kiranbiradar
Copy link

kiranbiradar commented Apr 23, 2019

#include<stdio.h>

int main()
{
 int j=0,i =0;

  for (i=0;i<5;i++)
   {
      for(j=i;j>=0;j--)
         printf("%d ",j);
    printf("\n");
   }

  for (i=0;i<5;i++)
   {
      for(j=0;j<=i;j++)
         printf("%d ",i+j+2);
    printf("\n");
   }
}

@Harshapriya123
Copy link
Author

Thanks kiranbiradar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment