Question 1:
#include <iostream>
using namespace std;
int main() {
    int num = 2;
    do {
       cout << "Table of " << num << ":" << endl;
       int i = 1;
       do {
           cout << num << " * " << i << " = " << num * i << endl;
           i++;
       } while (i <= 10);
       cout << endl;
       num++;
    } while (num <= 10);
    return 0;
Question: 2
#include <iostream>
using namespace std;
class Stack {
private:
    int arr[5];
    int top;
public:
  Stack() {
      top = -1;
  void push(int value) {
      if (top == 4) {
          cout << "Stack Overflow!" << endl;
          return;
      arr[++top] = value;
  int pop() {
      if (top == -1) {
          cout << "Stack Underflow!" << endl;
          return -1;
      return arr[top--];
  int peek() {
      if (top == -1) {
          cout << "Stack is empty!" << endl;
          return -1;
      return arr[top];
     }
     bool isEmpty() {
         return top == -1;
     bool isFull() {
         return top == 4;
};
int main() {
     Stack s;
     s.push(1);
     s.push(2);
     s.push(3);
     cout << "Top element: " << s.peek() << endl;
     cout << "Popped element: " << s.pop() << endl;
     cout << "Is stack empty? " << s.isEmpty() << endl;
     cout << "Is stack full? " << s.isFull() << endl;
     return 0;
Question 3:
#include <iostream>
#include <queue>
using namespace std;
int main() {
    queue<int> q;
    q.push(1);
    q.push(2);
    q.push(3);
    cout << q.front() << endl; // Output: 1
    q.pop();
    cout << q.front() << endl; // Output: 2
    return 0;
Question 4:
#include <iostream>
using namespace std;
int main() {
    int n;
    cout << "Enter an integer: ";
    cin >> n;
    int count = 0;
    n = abs(n);
    do {
       n /= 10;
        count++;
    } while (n != 0);
    cout << "Number of digits: " << count << endl;
    return 0;
Question:5
#include <iostream>
using namespace std;
int main() {
    int n = 123, product = 1, sum = 0;
    while (n) {
        int digit = n % 10;
        product *= digit;
        sum += digit;
        n /= 10;
    cout << (product == sum) << endl;
    return 0;