write a program to find 2 power of a 5digit number with out
using big int and exponent ?
Answer / Jitendra Pratap Singh
In C++, you can use bit manipulation to calculate the square of a 5-digit number without using BigInt or exponent. Here's an example:
```cpp
#include <iostream>
using namespace std;
void square(int num) {
int square = num << 1;
if (num & 1) { // If the least significant bit is set, add the number itself
square |= num;
}
}
int main() {
int num;
cout << "Enter a 5-digit number: ";
cin >> num;
square(num);
cout << "The square of the given number is: " << square << endl;
return 0;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
what is data abstraction with example.
What is differance between Abstract and Interface
What is difference between #define and const?
What does <> mean pseudocode?
What is abstraction in oop with example?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
#include <iostream> using namespace std; struct wow { int x; }; int main() { wow a; wow *b; a.x = 22; b = &a; a.x = 23; cout << b->x; return 0; }
What is the correct syntax for inheritance? 1) class aclass : public superclass 2) class aclass inherit superclass 3) class aclass <-superclass
What is byval and byref? What are differences between them?
Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.
Get me a number puzzle game-program
What is difference between data abstraction and encapsulation?