Write a program that takes a 5 digit number and calculates 2
power
that number and prints it.



Write a program that takes a 5 digit number and calculates 2 power that number and prints it. ..

Answer / Dushyant Singh Arya

Here is an example program in C++ to calculate the square of a 5-digit number:nn```cppn#include <iostream>nusing namespace std;nint main() {nint num, result = 0;ncout << "Enter a 5-digit number: ";ncin >> num;nresult = pow(num, 2);ncout << "The square of the entered number is: " << result;nnreturn 0;n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is the difference between while and do while loop?

1 Answers  


what is the difference between overloading & overriding? give example.

1 Answers  


const char * char * const What is the differnce between the above two?

11 Answers   TCS,


Do class method definitions?

1 Answers  


What are maps in c++?

1 Answers  


Find out the bug in this code,because of that this code will not compile....... #include <iostream> #include <new> #include <cstring> using namespace std; class balance { double cur_bal; char name[80]; public: balance(double n, char *s) { cur_bal = n; strcpy(name, s); } ~balance() { cout << "Destructing "; cout << name << "\n"; } void set(double n, char *s) { cur_bal = n; strcpy(name, s); } void get_bal(double &n, char *s) { n = cur_bal; strcpy(s, name); } }; int main() { balance *p; char s[80]; double n; int i; try { p = new balance [3]; // allocate entire array } catch (bad_alloc xa) { cout << "Allocation Failure\n"; return 1; }

2 Answers   Impetus,


What is c++ coding?

1 Answers  


Do you know what is overriding?

1 Answers  


Explain the ISA and HASA class relationships. How would you implement each in a class design?

3 Answers  


In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest.

5 Answers   GE,


What is a linked list in c++?

1 Answers  


check whether a no is prime or not.

3 Answers   TCS,


Categories