Sunday, 18 September 2016

Number pattern : Pyramid of square of 1 to 25

                  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;
}

No comments:

Post a Comment

Featured post

Will AI Replace Programmers? The Truth Behind the Hype in 2025

Exploring the Future of Coding: Will AI Take Over Software Development or Enhance It?  Will AI Replace Programmers? The Truth Behind the Hyp...