0

How to square a number in c++ program?

21st Jun 2017, 12:19 PM
Mildred Escudero
Mildred Escudero - avatar
2 Answers
+ 2
The syntax for C would be : #include<stdio.h> int main() { int a=9; int b=a*a; printf("%d",b); return 0; }
21st Jun 2017, 12:37 PM
Vidhi Tiwari
Vidhi Tiwari - avatar
+ 1
#include<math.h> a=2; sq=a*a; cout<<sq; or sq=sqr(a) cout<<sq;
21st Jun 2017, 12:21 PM
abul abbas
abul abbas - avatar