Search C Program | nimishsoft@gmail.com

Number Pattern - 41

                  1  
              4   9  16 
         25  36  49  64  81 
    100 121 144 169 196 225 256 
289 324 361 400 441 484 529 576 625

#include<stdio.h>

int main()
{
    int i, j, k=1;
    for(i=1;i<=5;i++)
    {
        for(j=i;j<5;j++)
        {
            printf("    ");
        }
        for(j=1;j<(i*2);j++)
        {
            printf("%3d ",k*k);
            k++;
        }
        printf("\n");
    }
    return 0;
}


Related Links:
- More Number Pattern Programs
- Star Pattern Programs in C
- Alphabet Pattern Programs in C
- Series Programs in C


3 comments:

  1. #include

    int main()
    {
    int r,i,j,k;

    printf("Enter the no. of rows : ");
    scanf("%d",&r);

    for(i=1,k=1;i<=r;i++)
    {
    for(j=1;j<=r-i;j++)
    {
    printf(" ");
    }

    for(j=1;j<=(2*i)-1;j++,k++)
    {
    printf("%3d ",k*k);
    }

    printf("\n");
    }

    return 0;
    }

    ReplyDelete
  2. int i,j,k=1;
    for(i=1;i<=5;i++)
    {
    for(j=i;j<=5;j++)
    {
    System.out.print(" ");

    }
    for(j=1;j<i+i;j++)
    {
    System.out.print(k*k + " ");
    k++;
    }
    System.out.println("");
    }

    ReplyDelete