ar
Feedback

لا تقع ضحية للمخادعين! تيليمتريو يكتشف ويُميّز هذه القنوات 👉 إذا كنت تريد رؤية العلامة، اشترك

Code With SaiPradeep

Code With SaiPradeep

الذهاب إلى القناة على Telegram

A space for curious minds to explore software engineering, computer science, programming and technology. Learn. Explore. Understand.

إظهار المزيد

📈 نظرة تحليلية على قناة تيليجرام Code With SaiPradeep

تُعد قناة Code With SaiPradeep (@codewithsaipradeep) في القطاع اللغوي الإنكليزية لاعباً نشطاً. يضم المجتمع حالياً 12 327 مشتركاً، محتلاً المرتبة 10 232 في فئة التكنولوجيات والتطبيقات والمرتبة 31 271 في منطقة الهند.

📊 مؤشرات الجمهور والحراك

منذ تأسيسه في невідомо، حقق المشروع نمواً سريعاً وجمع 12 327 مشتركاً.

بحسب آخر البيانات بتاريخ 12 نوفمبر, 2026، تحافظ القناة على نشاط مستقر. خلال آخر 30 يوماً تغيّر عدد الأعضاء بمقدار -238، وفي آخر 24 ساعة بمقدار -8، مع بقاء الوصول العام مرتفعاً.

  • حالة التحقق: غير موثّقة
  • معدل التفاعل (ER): يبلغ متوسط تفاعل الجمهور 10.45‎%. وخلال أول 24 ساعة من النشر يحصد المحتوى عادةً N/A‎% من ردود الفعل نسبةً إلى إجمالي المشتركين.
  • وصول المنشورات: يحصل كل منشور على متوسط 1 288 مشاهدة. وخلال اليوم الأول يجمع عادةً 0 مشاهدة.
  • التفاعلات والاستجابة: يتفاعل الجمهور بانتظام؛ متوسط التفاعلات لكل منشور يبلغ 11.
  • الاهتمامات الموضوعية: يركز المحتوى على مواضيع رئيسية مثل input, string, scanf("%d, array, element.

📝 الوصف وسياسة المحتوى

يصف المؤلف القناة بأنها مساحة للتعبير عن الآراء الذاتية:
“A space for curious minds to explore software engineering, computer science, programming and technology. Learn. Explore. Understand.”

بفضل وتيرة التحديث المرتفعة (أحدث البيانات بتاريخ 13 نوفمبر, 2026) تحافظ القناة على حداثتها ومستوى وصول مرتفع. وتُظهر التحليلات تفاعلاً نشطاً من الجمهور، ما يجعلها نقطة تأثير مهمة ضمن فئة التكنولوجيات والتطبيقات.

12 327
المشتركون
-824 ساعات
-827 أيام
-23830 أيام
أرشيف المشاركات
💻 Spiral Order Traversal of Matrix
#include <stdio.h>

int main() {
    int rows, cols, i, j;

    printf("Enter the number of rows: ");
    scanf("%d", &rows);
    printf("Enter the number of columns: ");
    scanf("%d", &cols);

    int matrix[rows][cols];

    printf("Enter the elements of the matrix:n");
    for (i = 0; i < rows; i++) {
        for (j = 0; j < cols; j++) {
            scanf("%d", &matrix[i][j]);
        }
    }

    int top = 0, bottom = rows - 1, left = 0, right = cols - 1, dir = 0; // 0: right, 1: down, 2: left, 3: up

    printf("Spiral order traversal: ");
    while (top <= bottom && left <= right) {
        if (dir == 0) {
            for (i = left; i <= right; i++) {
                printf("%d ", matrix[top][i]);
            }
            top++;
        } else if (dir == 1) {
            for (i = top; i <= bottom; i++) {
                printf("%d ", matrix[i][right]);
            }
            right--;
        } else if (dir == 2) {
            for (i = right; i >= left; i--) {
                printf("%d ", matrix[bottom][i]);
            }
            bottom--;
        } else if (dir == 3) {
            for (i = bottom; i >= top; i--) {
                printf("%d ", matrix[i][left]);
            }
            left++;
        }
        dir = (dir + 1) % 4;
    }
    printf("n");

    return 0;
}
📤 Output:
Input: 3
Input: 3
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Input: 7
Input: 8
Input: 9
Output: Enter the number of rows: Enter the number of columns: Enter the elements of the matrix:
Spiral order traversal: 1 2 3 6 9 8 7 4 5

💻 Rotate Matrix by 90 Degrees
#include <stdio.h>

int main() {
  int n;
  printf("Enter the size of the square matrix: ");
  scanf("%d", &n);

  int matrix[n][n];

  printf("Enter the elements of the matrix:n");
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &matrix[i][j]);
    }
  }

  int rotated_matrix[n][n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      rotated_matrix[j][n - 1 - i] = matrix[i][j];
    }
  }

  printf("Rotated Matrix (90 degrees clockwise):n");
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      printf("%d ", rotated_matrix[i][j]);
    }
    printf("n");
  }

  return 0;
}
📤 Output:
Input: 3
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Input: 7
Input: 8
Input: 9
Output: Enter the size of the square matrix: Enter the elements of the matrix:
Rotated Matrix (90 degrees clockwise):
7 4 1
8 5 2
9 6 3

💻 Matrix Multiplication Validation
#include <stdio.h>

int main() {
    int rowsA, colsA, rowsB, colsB;

    printf("Enter the number of rows for matrix A: ");
    scanf("%d", &rowsA);
    printf("Enter the number of columns for matrix A: ");
    scanf("%d", &colsA);

    printf("Enter the number of rows for matrix B: ");
    scanf("%d", &rowsB);
    printf("Enter the number of columns for matrix B: ");
    scanf("%d", &colsB);

    if (colsA == rowsB) {
        printf("Matrix multiplication is possible.n");
    } else {
        printf("Matrix multiplication is not possible.n");
    }

    return 0;
}
📤 Output:
Input: 2
Input: 3
Input: 3
Input: 4
Output: Enter the number of rows for matrix A: Enter the number of columns for matrix A: Enter the number of rows for matrix B: Enter the number of columns for matrix B: Matrix multiplication is possible.

Input: 2
Input: 3
Input: 4
Input: 5
Output: Enter the number of rows for matrix A: Enter the number of columns for matrix A: Enter the number of rows for matrix B: Enter the number of columns for matrix B: Matrix multiplication is not possible.

💻 Find Minimum Element in Matrix
#include <stdio.h>
#include <limits.h>

int main() {
    int rows, cols, i, j;

    printf("Enter the number of rows: ");
    scanf("%d", &rows);

    printf("Enter the number of columns: ");
    scanf("%d", &cols);

    int matrix[rows][cols];

    printf("Enter the elements of the matrix:n");
    for (i = 0; i < rows; i++) {
        for (j = 0; j < cols; j++) {
            scanf("%d", &matrix[i][j]);
        }
    }

    int min = INT_MAX;

    for (i = 0; i < rows; i++) {
        for (j = 0; j < cols; j++) {
            if (matrix[i][j] < min) {
                min = matrix[i][j];
            }
        }
    }

    printf("Minimum element in the matrix is: %dn", min);

    return 0;
}
📤 Output:
Input: 2
Input: 3
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Output: Minimum element in the matrix is: 1

💻 Find Maximum Element in Matrix
#include <stdio.h>

int main() {
    int rows, cols;

    printf("Enter the number of rows: ");
    scanf("%d", &rows);

    printf("Enter the number of columns: ");
    scanf("%d", &cols);

    int matrix[rows][cols];

    printf("Enter the elements of the matrix:n");
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            scanf("%d", &matrix[i][j]);
        }
    }

    int max = matrix[0][0];

    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            if (matrix[i][j] > max) {
                max = matrix[i][j];
            }
        }
    }

    printf("Maximum element in the matrix is: %dn", max);

    return 0;
}
📤 Output:
Input: 2
Input: 3
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Output: Maximum element in the matrix is: 6

Input: 3
Input: 2
Input: -1
Input: -2
Input: -3
Input: -4
Input: -5
Input: -6
Output: Maximum element in the matrix is: -1

💻 Find Row Sum and Column Sum
#include <stdio.h>

int main() {
    int rows, cols;

    printf("Enter the number of rows: ");
    scanf("%d", &rows);
    printf("Enter the number of columns: ");
    scanf("%d", &cols);

    int matrix[rows][cols];

    printf("Enter the elements of the matrix:n");
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            scanf("%d", &matrix[i][j]);
        }
    }

    printf("Row Sums:n");
    for (int i = 0; i < rows; i++) {
        int rowSum = 0;
        for (int j = 0; j < cols; j++) {
            rowSum += matrix[i][j];
        }
        printf("Row %d: %dn", i + 1, rowSum);
    }

    printf("Column Sums:n");
    for (int j = 0; j < cols; j++) {
        int colSum = 0;
        for (int i = 0; i < rows; i++) {
            colSum += matrix[i][j];
        }
        printf("Column %d: %dn", j + 1, colSum);
    }

    return 0;
}
📤 Output:
Input: 2
Input: 3
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Output: Enter the number of rows: Enter the number of columns: Enter the elements of the matrix:
Row Sums:
Row 1: 6
Row 2: 15
Column Sums:
Column 1: 5
Column 2: 7
Column 3: 9

💻 Check if Matrix is Identity Matrix
#include <stdio.h>
#include <stdbool.h>

int main() {
  int rows, cols;

  printf("Enter the number of rows: ");
  scanf("%d", &rows);
  printf("Enter the number of columns: ");
  scanf("%d", &cols);

  int matrix[rows][cols];

  printf("Enter the elements of the matrix:n");
  for (int i = 0; i < rows; i++) {
    for (int j = 0; j < cols; j++) {
      scanf("%d", &matrix[i][j]);
    }
  }

  bool isIdentity = true;

  if (rows != cols) {
    isIdentity = false;
  } else {
    for (int i = 0; i < rows; i++) {
      for (int j = 0; j < cols; j++) {
        if (i == j) {
          if (matrix[i][j] != 1) {
            isIdentity = false;
            break;
          }
        } else {
          if (matrix[i][j] != 0) {
            isIdentity = false;
            break;
          }
        }
      }
      if (!isIdentity) {
        break;
      }
    }
  }

  if (isIdentity) {
    printf("The matrix is an Identity Matrix.n");
  } else {
    printf("The matrix is not an Identity Matrix.n");
  }

  return 0;
}
📤 Output:
Input: 3
Input: 3
Input: 1
Input: 0
Input: 0
Input: 0
Input: 1
Input: 0
Input: 0
Input: 0
Input: 1
Output: The matrix is an Identity Matrix.

Input: 2
Input: 2
Input: 1
Input: 0
Input: 0
Input: 2
Output: The matrix is not an Identity Matrix.

Input: 2
Input: 3
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Output: The matrix is not an Identity Matrix.

💻 Check if Matrix is Symmetric
#include <stdio.h>
#include <stdbool.h>

int main() {
    int rows, cols;

    printf("Enter the number of rows: ");
    scanf("%d", &rows);
    printf("Enter the number of columns: ");
    scanf("%d", &cols);

    if (rows != cols) {
        printf("Matrix is not square, so it cannot be symmetric.n");
        return 0;
    }

    int matrix[rows][cols];

    printf("Enter the elements of the matrix:n");
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            scanf("%d", &matrix[i][j]);
        }
    }

    bool isSymmetric = true;
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            if (matrix[i][j] != matrix[j][i]) {
                isSymmetric = false;
                break;
            }
        }
        if (!isSymmetric) {
            break;
        }
    }

    if (isSymmetric) {
        printf("The matrix is symmetric.n");
    } else {
        printf("The matrix is not symmetric.n");
    }

    return 0;
}
📤 Output:
Input: 3
Input: 3
Input: 1
Input: 2
Input: 3
Input: 2
Input: 4
Input: 5
Input: 3
Input: 5
Input: 6
Output: The matrix is symmetric.

Input: 2
Input: 3
Output: Matrix is not square, so it cannot be symmetric.

Input: 2
Input: 2
Input: 1
Input: 2
Input: 3
Input: 4
Output: The matrix is not symmetric.

💻 Sum of Secondary Diagonal Elements
#include <stdio.h>

int main() {
    int rows, cols;
    printf("Enter the number of rows: ");
    scanf("%d", &rows);
    printf("Enter the number of columns: ");
    scanf("%d", &cols);

    if (rows != cols) {
        printf("Matrix must be square for secondary diagonal sum.n");
        return 1;
    }

    int matrix[rows][cols];
    printf("Enter the elements of the matrix:n");
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            scanf("%d", &matrix[i][j]);
        }
    }

    int sum = 0;
    for (int i = 0; i < rows; i++) {
        sum += matrix[i][cols - 1 - i];
    }

    printf("Sum of secondary diagonal elements: %dn", sum);

    return 0;
}
📤 Output:
Input: 3
Input: 3
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Input: 7
Input: 8
Input: 9
Output: Sum of secondary diagonal elements: 15

Input: 2
Input: 4
Output: Matrix must be square for secondary diagonal sum.

💻 Sum of Main Diagonal Elements
#include <stdio.h>

int main() {
    int rows, cols, i, j, sum = 0;

    printf("Enter the number of rows: ");
    scanf("%d", &rows);
    printf("Enter the number of columns: ");
    scanf("%d", &cols);

    if (rows != cols) {
        printf("Matrix must be square to calculate the sum of the main diagonal.n");
        return 1;
    }

    int matrix[rows][cols];

    printf("Enter the elements of the matrix:n");
    for (i = 0; i < rows; i++) {
        for (j = 0; j < cols; j++) {
            scanf("%d", &matrix[i][j]);
        }
    }

    for (i = 0; i < rows; i++) {
        sum = sum + matrix[i][i]; // Add the diagonal element to sum
    }

    printf("Sum of main diagonal elements: %dn", sum);

    return 0;
}
📤 Output:
Input: 3
Input: 3
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Input: 7
Input: 8
Input: 9
Output: Sum of main diagonal elements: 15

Input: 2
Input: 4
Output: Matrix must be square to calculate the sum of the main diagonal.

💻 Transpose of a Matrix
#include <stdio.h>

int main() {
    int rows, cols, i, j;

    printf("Enter the number of rows: ");
    scanf("%d", &rows);
    printf("Enter the number of columns: ");
    scanf("%d", &cols);

    int matrix[rows][cols], transpose[cols][rows];

    printf("Enter the elements of the matrix:n");
    for (i = 0; i < rows; i++) {
        for (j = 0; j < cols; j++) {
            scanf("%d", &matrix[i][j]);
        }
    }

    for (i = 0; i < rows; i++) {
        for (j = 0; j < cols; j++) {
            transpose[j][i] = matrix[i][j];
        }
    }

    printf("Transpose of the matrix:n");
    for (i = 0; i < cols; i++) {
        for (j = 0; j < rows; j++) {
            printf("%d ", transpose[i][j]);
        }
        printf("n");
    }

    return 0;
}
📤 Output:
Input: 2
Input: 3
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Output: Enter the number of rows: Enter the number of columns: Enter the elements of the matrix:
Transpose of the matrix:
1 4
2 5
3 6

💻 Multiply Two Matrices
#include <stdio.h>

int main() {
  int row1, col1, row2, col2;

  printf("Enter the number of rows and columns for the first matrix: ");
  scanf("%d %d", &row1, &col1);

  printf("Enter the number of rows and columns for the second matrix: ");
  scanf("%d %d", &row2, &col2);

  if (col1 != row2) {
    printf("Matrices cannot be multiplied.n");
    return 1;
  }

  int matrix1[row1][col1], matrix2[row2][col2], result[row1][col2];
  int i, j, k;

  printf("Enter the elements of the first matrix:n");
  for (i = 0; i < row1; i++) {
    for (j = 0; j < col1; j++) {
      scanf("%d", &matrix1[i][j]);
    }
  }

  printf("Enter the elements of the second matrix:n");
  for (i = 0; i < row2; i++) {
    for (j = 0; j < col2; j++) {
      scanf("%d", &matrix2[i][j]);
    }
  }

  for (i = 0; i < row1; i++) {
    for (j = 0; j < col2; j++) {
      result[i][j] = 0;
      for (k = 0; k < col1; k++) {
        result[i][j] += matrix1[i][k] * matrix2[k][j];
      }
    }
  }

  printf("Resultant matrix:n");
  for (i = 0; i < row1; i++) {
    for (j = 0; j < col2; j++) {
      printf("%d ", result[i][j]);
    }
    printf("n");
  }

  return 0;
}
📤 Output:
Input: 2 2
Input: 2 2
Input: 1 2
Input: 3 4
Input: 5 6
Input: 7 8
Output: Enter the number of rows and columns for the first matrix: Enter the number of rows and columns for the second matrix: Enter the elements of the first matrix:
Enter the elements of the second matrix:
Resultant matrix:
19 22
43 50

💻 Subtract Two Matrices
#include <stdio.h>

int main() {
    int rows, cols;

    printf("Enter the number of rows: ");
    scanf("%d", &rows);
    printf("Enter the number of columns: ");
    scanf("%d", &cols);

    int matrix1[rows][cols], matrix2[rows][cols], result[rows][cols];

    printf("Enter elements of the first matrix:n");
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            scanf("%d", &matrix1[i][j]);
        }
    }

    printf("Enter elements of the second matrix:n");
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            scanf("%d", &matrix2[i][j]);
        }
    }

    // Subtract the matrices
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            result[i][j] = matrix1[i][j] - matrix2[i][j];
        }
    }

    printf("Resultant matrix after subtraction:n");
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            printf("%d ", result[i][j]);
        }
        printf("n");
    }

    return 0;
}
📤 Output:
Input: 2
Input: 2
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Input: 7
Input: 8
Output: Enter the number of rows: Enter the number of columns: Enter elements of the first matrix:
Enter elements of the second matrix:
Resultant matrix after subtraction:
-4 -4
-4 -4

💻 Add Two Matrices
#include <stdio.h>

int main() {
    int rows, cols;

    printf("Enter the number of rows: ");
    scanf("%d", &rows);
    printf("Enter the number of columns: ");
    scanf("%d", &cols);

    int matrix1[rows][cols], matrix2[rows][cols], sum[rows][cols];

    printf("Enter elements of the first matrix:n");
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            scanf("%d", &matrix1[i][j]);
        }
    }

    printf("Enter elements of the second matrix:n");
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            scanf("%d", &matrix2[i][j]);
        }
    }

    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            sum[i][j] = matrix1[i][j] + matrix2[i][j];
        }
    }

    printf("Sum of the matrices:n");
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            printf("%d ", sum[i][j]);
        }
        printf("n");
    }

    return 0;
}
📤 Output:
Input: 2
Input: 3
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Input: 7
Input: 8
Input: 9
Input: 10
Input: 11
Input: 12
Output: Enter the number of rows: Enter the number of columns: Enter elements of the first matrix:
Enter elements of the second matrix:
Sum of the matrices:
8 10 12
14 16 18

🔧 Arrays - 2D

💻 Count Occurrences of Element in Array
#include <stdio.h>

int main() {
    int arr[100];
    int n, i, target, count = 0;

    printf("Enter the number of elements in the array: ");
    scanf("%d", &n);

    printf("Enter the elements of the array:n");
    for (i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }

    printf("Enter the element to count: ");
    scanf("%d", &target);

    for (i = 0; i < n; i++) {
        if (arr[i] == target) {
            count++;
        }
    }

    printf("The element %d occurs %d times in the array.n", target, count);

    return 0;
}
📤 Output:
Input: 5
Input: 1
Input: 2
Input: 2
Input: 3
Input: 2
Input: 2
Output: Enter the number of elements in the array: Enter the elements of the array:
Enter the element to count: The element 2 occurs 3 times in the array.

💻 Find All Prime Numbers in Array
#include <stdio.h>
#include <stdbool.h>

bool isPrime(int n) {
  if (n <= 1) return false;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}

int main() {
  int size;

  printf("Enter the size of the array: ");
  scanf("%d", &size);

  int arr[size];

  printf("Enter the elements of the array: ");
  for (int i = 0; i < size; i++) {
    scanf("%d", &arr[i]);
  }

  printf("Prime numbers in the array are: ");
  for (int i = 0; i < size; i++) {
    if (isPrime(arr[i])) {
      printf("%d ", arr[i]);
    }
  }
  printf("n");

  return 0;
}
📤 Output:
Input: 5
Input: 1 2 3 4 5
Output: Enter the size of the array: Enter the elements of the array: Prime numbers in the array are: 2 3 5

💻 Split Array into Even and Odd Numbers
#include <stdio.h>

int main() {
  int arr[100];
  int even[100];
  int odd[100];
  int n, i, even_count = 0, odd_count = 0;

  printf("Enter the number of elements in the array: ");
  scanf("%d", &n);

  printf("Enter the elements of the array:n");
  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }

  for (i = 0; i < n; i++) {
    if (arr[i] % 2 == 0) {
      even[even_count] = arr[i];
      even_count++;
    } else {
      odd[odd_count] = arr[i];
      odd_count++;
    }
  }

  printf("Even numbers in the array are:n");
  for (i = 0; i < even_count; i++) {
    printf("%d ", even[i]);
  }
  printf("n");

  printf("Odd numbers in the array are:n");
  for (i = 0; i < odd_count; i++) {
    printf("%d ", odd[i]);
  }
  printf("n");

  return 0;
}
📤 Output:
Input: 5
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Output: Enter the number of elements in the array: Enter the elements of the array:
Even numbers in the array are:
2 4
Odd numbers in the array are:
1 3 5

💻 Find Mode of Array
#include <stdio.h>

int main() {
    int arr[100];
    int n, i, j;

    printf("Enter the number of elements in the array: ");
    scanf("%d", &n);

    printf("Enter the elements of the array:n");
    for (i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }

    int mode = arr[0];
    int maxCount = 1;

    for (i = 0; i < n; i++) {
        int count = 1;
        for (j = i + 1; j < n; j++) {
            if (arr[i] == arr[j]) {
                count++;
            }
        }
        if (count > maxCount) {
            maxCount = count;
            mode = arr[i];
        }
    }

    printf("Mode of the array is: %dn", mode);

    return 0;
}
📤 Output:
Input: 5
Input: 1
Input: 2
Input: 2
Input: 3
Input: 2
Output: Mode of the array is: 2

Input: 7
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Input: 7
Output: Mode of the array is: 1

Input: 6
Input: 5
Input: 5
Input: 5
Input: 1
Input: 2
Input: 3
Output: Mode of the array is: 5

Input: 4
Input: 2
Input: 2
Input: 1
Input: 1
Output: Mode of the array is: 2

💻 Find Median of Array
#include <stdio.h>
#include <stdlib.h>

int main() {
    int n;
    printf("Enter the number of elements in the array: ");
    scanf("%d", &n);

    int arr[n];
    printf("Enter the elements of the array:n");
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }

    // Sort the array (using bubble sort for simplicity)
    for (int i = 0; i < n - 1; i++) {
        for (int j = 0; j < n - i - 1; j++) {
            if (arr[j] > arr[j + 1]) {
                int temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }

    float median;
    if (n % 2 == 0) {
        // If the number of elements is even
        median = (float)(arr[n / 2 - 1] + arr[n / 2]) / 2;
    } else {
        // If the number of elements is odd
        median = (float)arr[n / 2];
    }

    printf("The median of the array is: %.2fn", median);

    return 0;
}
📤 Output:
Input: 5
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Output: The median of the array is: 3.00

Input: 6
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Output: The median of the array is: 3.50