Simple Program To Find Square Of A Given Number
It is the one of the simple programs. In this we have used very simple logic of finding square of a given number which we have studied in school. The logic is very simple as below :-
square of 2 = 2 * 2,
that means square of no = no * no
we have implemented it in following program :
Code :-
#include<stdio.h>
#include<conio.h>
void main()
{
int n,sq;
printf("Enter a Number: ");
scanf("%d",&n);
sq = n * n;
printf("Square of %d is %d ",n,sq);
getch();
}
output:
When we run the program we give a number as input and compiler process it and gives us square of number as output. Now in this program there is only one input number can give to computer and only one output will displayed.
This is much basic program for beginners
If you do not have turbo c compiler you can compile the program online:
Check out my video related this program on You Tube :
Programming solutions, pre-compiled codes, ready projects for computer engineering, and many more interesting things...
Comment Below if any question 🠟🠟🠟 Thank You!
Comments
Post a Comment