\\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
#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
Tags:
c program
find square of numbers
numbers square.
print square without using "*"
square without multiply sign