Number Pattern : 27

Program:

#include<stdio.h>
int main()
{
int i,j,k,n;
printf("How many lines: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(k=1;k<=n-i;k++)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf("%d ",i);
}
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(...