write a c++ program to find the square of a number
Answers
Answered by
1
Answer:
C Program to Print Square of a Number
#include<stdio.h>
int main() {
int num, sqr;
printf("Enter a number \n");
scanf("%d", &num);
// calculate square of a number
sqr = num * num;
printf("Square of an input number is %d", sqr);
return 0;
}
C++ Program to Print Square of a Number
#include <iostream.h>
using namespace std;
int main() {
int num,sqr;
cout << "Enter a number \n";
cin >> num;
// Calculate square of a number
sqr = num * num;
cout << " Square of a number is " << sqr;
return 0;
}
Similar questions
Computer Science,
2 months ago
Science,
2 months ago
English,
5 months ago
Computer Science,
5 months ago
Hindi,
10 months ago
Math,
10 months ago