Skip to content

Instantly share code, notes, and snippets.

@saiedabbas93
Created September 11, 2019 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saiedabbas93/9154639dbccd93e5eea4e1166e0285ae to your computer and use it in GitHub Desktop.
Save saiedabbas93/9154639dbccd93e5eea4e1166e0285ae to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i,j,k,power,a,d1,b,d2,c,d3,d,d4,e,d5;
for(i=0;i<=4;i++)
{
for(j=8;j>i;j--)
{
printf(" ");
}
power=pow(11,i);
a=power/10;
d1=power%10;
b=a/10;
d2=a%10;
c=b/10;
d3=b%10;
d=c/10;
d4=c%10;
e=d/10;
d5=d%10;
if(i==0)
printf("%d ",power);
if(i==1)
printf("%d %d ",d1,d2);
if(i==2)
printf("%d %d %d ",d3,d2,d1);
if(i==3)
printf("%d %d %d %d ",d4,d3,d2,d1);
if(i==4)
printf("%d %d %d %d %d ",d5,d4,d3,d2,d1);
printf("\n");
}
}
@saiedabbas93
Copy link
Author

Output:

            1
          1   1
        1   2   1
      1   3   3   1
    1   4   6   4   1

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