WAP to print square without using " * ".

\\C program to print square without using "*".
#include<conio.h>
int Squares(int n)
{
int square = 0, a = 0;
for (int x = 0; x <= n; x++)
{
square = (square + x + a);
printf("\n%d", square);
a = x;
}
}
int main()
{
int n;
printf("Enter the value of n=");
scanf("%d",&n);
Squares(n);
}

Expected Output:
Enter the value of n=5
0
1
4
9
16
25

Post a Comment

Previous Post Next Post