Number Pattern : 30

Program:

#include<stdio.h>;
int main()
{
int i,j,k,s,n;
printf("How many lines: ");
scanf("%d",&amp;n);
for(i=0;i&lt;=n;i++)
{
for(k=1;k&lt;=n-i;k++)
{
printf("    ");
}
for(j=-i;j&lt;=i;j++)
{
printf("%4d",j);
}
printf("\n");
  }
return 0;
}

Output:



No comments:

Post a Comment

x^y using recursion

Program: #include<stdio.h> int power(int a,int b); int main() { int x,y,ans; printf("Enter x and y:\n "); scanf(...