Find Square Of Number In C Programming Tutorials

Write A Program To Input Two Numbers And Find Out Its Square Of The Number - C Online Classes
\\ If you have any query or questions on my post, then please comment below //

WAP To Input A Number And Find Out Its Square 
For Finding Square we can use 3 methods:
1. By Multiplying The Number In 2 Times.
2. Using C Power Formula For Finding Square, Syntax:
"ans = pow(number to find,how much power);"

I will write the program in both the methods 
Program 5: WAP To Find Square Of The Numbers By Multiplication:
------------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("Enter Number To Find Square:");
scanf("%d", &a);

b=a*a;
printf("Square of 2 Numbers is:%d "b);
getch();
}  

------------------------------------------------------------- 
if you enter a =2 then: 
b =a*a; 
b=2*2;
b=4
So Output Of This Program If We Enter a =2 then 4.


Program 6: WAP To Find Square Of The Numbers By Using Power Formula:
------------------------------------------------------------------
#include<stdio.h>
#include<conio.h>

#include<math.h>
void main()
{
int a,b;
printf("Enter Number To Find Square:");
scanf("%d", &a);

b=pow(a,2);
printf("Square of 2 Numbers is:%d "b);
getch();
}  

------------------------------------------------------------- 
if you enter a =3 then: 
b =pow(a,2);
b=pow(3,2); 
b=9
So Output Of This Program If We Enter a =3 then 9.and for using pow function we have to add math.h header file.
Video Tutorials On Finding Square Of A number:

Click Here To Know How To Download Above Video Tutorials Or YouTube Videos Free


 Enter Your Email Id To Get Our Programming, Web Development, Video Tutorial, Job Updates In Mail :

Labels: