Computer Science, asked by warriorprime172004, 5 months ago

write a c++ program to find the square of a number ​

Answers

Answered by Anonymous
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