es
Feedback
C Programming Codes

C Programming Codes

Ir al canal en Telegram

C Programming Codes || Quizzes || DSA Learn along with the community Any queries admin - @Pradeep_saii

Mostrar más

📈 Análisis del canal de Telegram C Programming Codes

El canal C Programming Codes (@c_programming_codes) en el segmento lingüístico de Inglés es un actor destacado. Actualmente la comunidad reúne a 13 431 suscriptores, ocupando la posición 9 534 en la categoría Tecnologías y Aplicaciones y el puesto 32 075 en la región India.

📊 Métricas de audiencia y dinámica

Desde su creación el невідомо, el proyecto ha mostrado un crecimiento acelerado, reuniendo a 13 431 suscriptores.

Según los últimos datos del 11 junio, 2026, el canal mantiene una actividad estable. En los últimos 30 días la variación de miembros fue de -239, y en las últimas 24 horas de -9, conservando un alto alcance.

  • Estado de verificación: No verificado
  • Tasa de interacción (ER): El promedio de interacción de la audiencia es 9.78%. Durante las primeras 24 horas tras publicar, el contenido suele obtener N/A% de reacciones respecto al total de suscriptores.
  • Alcance de las publicaciones: Cada publicación recibe en promedio 0 visualizaciones. En el primer día suele acumular 0 visualizaciones.
  • Reacciones e interacción: La audiencia responde de forma activa: el promedio de reacciones por publicación es 0.
  • Intereses temáticos: El contenido se centra en temas clave como input, string, scanf("%d, array, element.

📝 Descripción y política de contenido

El autor describe el recurso como un espacio para expresar opiniones subjetivas:
C Programming Codes || Quizzes || DSA Learn along with the community Any queries admin - @Pradeep_saii

Gracias a la alta frecuencia de actualizaciones (últimos datos recibidos el 12 junio, 2026), el canal mantiene la vigencia y un amplio alcance. La analítica demuestra que la audiencia interactúa activamente con el contenido, lo que lo convierte en un punto de referencia dentro de la categoría Tecnologías y Aplicaciones.

13 431
Suscriptores
-924 horas
-577 días
-23930 días
Archivo de publicaciones
💻 Function to Calculate LCM
#include <stdio.h>

int findLCM(int a, int b) {
    int max = (a > b) ? a : b;
    while (1) {
        if (max % a == 0 && max % b == 0) {
            return max;
        }
        max++;
    }
}

int main() {
    int num1, num2, lcm;

    printf("Enter two positive integers: ");
    scanf("%d %d", &num1, &num2);

    lcm = findLCM(num1, num2);

    printf("LCM of %d and %d is %dn", num1, num2, lcm);

    return 0;
}
📤 Output:
Input: 12 18
Output: Enter two positive integers: LCM of 12 and 18 is 36

Input: 5 7
Output: Enter two positive integers: LCM of 5 and 7 is 35

Input: 24 36
Output: Enter two positive integers: LCM of 24 and 36 is 72

💻 Function to Calculate GCD/HCF (Euclidean Algorithm)
#include <stdio.h>

int gcd(int a, int b) {
    while (b != 0) {
        int temp = b;
        b = a % b;
        a = temp;
    }
    return a;
}

int main() {
    int num1, num2;

    printf("Enter two integers: ");
    scanf("%d %d", &num1, &num2);

    int result = gcd(num1, num2);

    printf("GCD of %d and %d is %dn", num1, num2, result);

    return 0;
}
📤 Output:
Input: 48 18
Output: Enter two integers: GCD of 48 and 18 is 6
Input: 1071 462
Output: Enter two integers: GCD of 1071 and 462 is 21
Input: 12 18
Output: Enter two integers: GCD of 12 and 18 is 6
Input: 5 7
Output: Enter two integers: GCD of 5 and 7 is 1
Input: 25 15
Output: Enter two integers: GCD of 25 and 15 is 5

💻 Function to Calculate nPr (Permutations)
#include <stdio.h>

long long factorial(int n) {
    long long fact = 1;
    for (int i = 1; i <= n; i++) {
        fact *= i;
    }
    return fact;
}

long long nPr(int n, int r) {
    if (r > n) {
        return 0;
    }
    return factorial(n) / factorial(n - r);
}

int main() {
    int n, r;
    printf("Enter the value of n: ");
    scanf("%d", &n);
    printf("Enter the value of r: ");
    scanf("%d", &r);

    long long result = nPr(n, r);

    printf("nPr (%d, %d) = %lldn", n, r, result);

    return 0;
}
📤 Output:
Input: 5
Input: 2
Output: nPr (5, 2) = 20

Input: 7
Input: 7
Output: nPr (7, 7) = 5040

Input: 10
Input: 3
Output: nPr (10, 3) = 720

Input: 4
Input: 5
Output: nPr (4, 5) = 0

💻 Function to Calculate nCr (Combinations)
#include <stdio.h>

int factorial(int n) {
    int fact = 1;
    for (int i = 1; i <= n; i++) {
        fact *= i;
    }
    return fact;
}

int nCr(int n, int r) {
    if (r < 0 || r > n) {
        return 0;
    }
    return factorial(n) / (factorial(r) * factorial(n - r));
}

int main() {
    int n, r;

    printf("Enter the value of n: ");
    scanf("%d", &n);

    printf("Enter the value of r: ");
    scanf("%d", &r);

    printf("nCr(%d, %d) = %dn", n, r, nCr(n, r));

    return 0;
}
📤 Output:
Input: 5
Input: 2
Output: nCr(5, 2) = 10

Input: 7
Input: 0
Output: nCr(7, 0) = 1

Input: 4
Input: 4
Output: nCr(4, 4) = 1

Input: 6
Input: 3
Output: nCr(6, 3) = 20

Input: 5
Input: -1
Output: nCr(5, -1) = 0

Input: 5
Input: 6
Output: nCr(5, 6) = 0

💻 Function to Check Armstrong Number
#include <stdio.h>
#include <math.h>

int isArmstrong(int num) {
  int originalNum, remainder, n = 0;
  double result = 0.0;

  originalNum = num;

  // Count number of digits
  while (originalNum != 0) {
    originalNum /= 10;
    ++n;
  }

  originalNum = num;

  // Calculate sum of digits raised to the power n
  while (originalNum != 0) {
    remainder = originalNum % 10;
    result += pow(remainder, n);
    originalNum /= 10;
  }

  // Check if number is Armstrong
  if ((int)result == num) {
    return 1; // True
  } else {
    return 0; // False
  }
}

int main() {
  int number;

  printf("Enter an integer: ");
  scanf("%d", &number);

  if (isArmstrong(number)) {
    printf("%d is an Armstrong number.n", number);
  } else {
    printf("%d is not an Armstrong number.n", number);
  }

  return 0;
}
📤 Output:
Input: 153
Output: 153 is an Armstrong number.

Input: 120
Output: 120 is not an Armstrong number.

Input: 370
Output: 370 is an Armstrong number.

Input: 1634
Output: 1634 is an Armstrong number.

Input: 123
Output: 123 is not an Armstrong number.

💻 Function to Check Palindrome
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int isPalindrome(char str[]) {
    int left = 0;
    int right = strlen(str) - 1;

    while (left < right) {
        if (str[left] != str[right]) {
            return 0;
        }
        left++;
        right--;
    }
    return 1;
}

int main() {
    char inputString[100];

    printf("Enter a string: ");
    scanf("%s", inputString);

    if (isPalindrome(inputString)) {
        printf(""%s" is a palindrome.n", inputString);
    } else {
        printf(""%s" is not a palindrome.n", inputString);
    }

    return 0;
}
📤 Output:
Input: madam
Output: "madam" is a palindrome.

Input: hello
Output: "hello" is not a palindrome.

Input: A man a plan a canal Panama
Output: "A" is not a palindrome.

💻 Function to Calculate Factorial
#include <stdio.h>

int factorial(int n) {
  if (n == 0) {
    return 1;
  } else {
    return n * factorial(n - 1);
  }
}

int main() {
  int num;
  printf("Enter a non-negative integer: ");
  scanf("%d", &num);

  if (num < 0) {
    printf("Factorial is not defined for negative numbers.n");
  } else {
    int result = factorial(num);
    printf("Factorial of %d = %dn", num, result);
  }
  return 0;
}
📤 Output:
Input: 5
Output: Enter a non-negative integer: Factorial of 5 = 120

Input: 0
Output: Enter a non-negative integer: Factorial of 0 = 1

Input: -2
Output: Enter a non-negative integer: Factorial is not defined for negative numbers.

💻 Function to Check Prime Number
#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 num;
    printf("Enter a number: ");
    scanf("%d", &num);

    if (isPrime(num)) {
        printf("%d is a prime number.n", num);
    } else {
        printf("%d is not a prime number.n", num);
    }

    return 0;
}
📤 Output:
Input: 7
Output: 7 is a prime number.

Input: 12
Output: 12 is not a prime number.

Input: 1
Output: 1 is not a prime number.

Input: 0
Output: 0 is not a prime number.

Input: -5
Output: -5 is not a prime number.

🔧 Functions

💻 Game Character Movement Simulation
#include <stdio.h>

int main() {
  int x = 0, y = 0;
  char move;

  do {
    printf("Current position: (%d, %d)n", x, y);
    printf("Enter move (w/a/s/d - wasd keys for up/left/down/right, q to quit): ");
    scanf(" %c", &move);

    switch (move) {
      case 'w':
        y++;
        break;
      case 'a':
        x--;
        break;
      case 's':
        y--;
        break;
      case 'd':
        x++;
        break;
      case 'q':
        printf("Quitting the game.n");
        break;
      default:
        printf("Invalid move. Try again.n");
    }
  } while (move != 'q');

  return 0;
}
📤 Output:
Current position: (0, 0)
Enter move (w/a/s/d - wasd keys for up/left/down/right, q to quit): Input: w
Output: Current position: (0, 1)
Enter move (w/a/s/d - wasd keys for up/left/down/right, q to quit): Input: a
Output: Current position: (-1, 1)
Enter move (w/a/s/d - wasd keys for up/left/down/right, q to quit): Input: s
Output: Current position: (-1, 0)
Enter move (w/a/s/d - wasd keys for up/left/down/right, q to quit): Input: d
Output: Current position: (0, 0)
Enter move (w/a/s/d - wasd keys for up/left/down/right, q to quit): Input: x
Output: Invalid move. Try again.
Current position: (0, 0)
Enter move (w/a/s/d - wasd keys for up/left/down/right, q to quit): Input: q
Output: Quitting the game.

💻 Temperature Conversion Menu
#include <stdio.h>

int main() {
    int choice;
    float temp, converted_temp;

    do {
        printf("Temperature Conversion Menu:n");
        printf("1. Celsius to Fahrenheitn");
        printf("2. Fahrenheit to Celsiusn");
        printf("3. Exitn");
        printf("Enter your choice: ");
        scanf("%d", &choice);

        switch (choice) {
            case 1:
                printf("Enter temperature in Celsius: ");
                scanf("%f", &temp);
                converted_temp = (temp * 9 / 5) + 32;
                printf("Temperature in Fahrenheit: %.2fn", converted_temp);
                break;
            case 2:
                printf("Enter temperature in Fahrenheit: ");
                scanf("%f", &temp);
                converted_temp = (temp - 32) * 5 / 9;
                printf("Temperature in Celsius: %.2fn", converted_temp);
                break;
            case 3:
                printf("Exiting...n");
                break;
            default:
                printf("Invalid choice. Please try again.n");
        }
    } while (choice != 3);

    return 0;
}
📤 Output:
Temperature Conversion Menu:
1. Celsius to Fahrenheit
2. Fahrenheit to Celsius
3. Exit
Enter your choice: Input: 1
Enter temperature in Celsius: Input: 25
Output: Temperature in Fahrenheit: 77.00
Temperature Conversion Menu:
1. Celsius to Fahrenheit
2. Fahrenheit to Celsius
3. Exit
Enter your choice: Input: 2
Enter temperature in Fahrenheit: Input: 98.6
Output: Temperature in Celsius: 37.00
Temperature Conversion Menu:
1. Celsius to Fahrenheit
2. Fahrenheit to Celsius
3. Exit
Enter your choice: Input: 3
Output: Exiting...

💻 Simple ATM Machine Simulation
#include <stdio.h>
#include <stdlib.h>

int main() {
    int option;
    float balance = 1000.0;
    float amount;

    do {
        printf("ATM Menu:n");
        printf("1. Check Balancen");
        printf("2. Depositn");
        printf("3. Withdrawn");
        printf("4. Exitn");
        printf("Enter your option: ");
        scanf("%d", &option);

        switch (option) {
            case 1:
                printf("Your balance is: %.2fn", balance);
                break;
            case 2:
                printf("Enter amount to deposit: ");
                scanf("%f", &amount);
                if (amount > 0) {
                    balance += amount;
                    printf("Deposit successful. New balance: %.2fn", balance);
                } else {
                    printf("Invalid amount.n");
                }
                break;
            case 3:
                printf("Enter amount to withdraw: ");
                scanf("%f", &amount);
                if (amount > 0 && amount <= balance) {
                    balance -= amount;
                    printf("Withdrawal successful. New balance: %.2fn", balance);
                } else {
                    printf("Insufficient funds or invalid amount.n");
                }
                break;
            case 4:
                printf("Exiting ATM. Thank you!n");
                break;
            default:
                printf("Invalid option. Please try again.n");
        }
    } while (option != 4);

    return 0;
}
📤 Output:
ATM Menu:
1. Check Balance
2. Deposit
3. Withdraw
4. Exit
Enter your option: Input: 1
Output: Your balance is: 1000.00
ATM Menu:
1. Check Balance
2. Deposit
3. Withdraw
4. Exit
Enter your option: Input: 2
Output: Enter amount to deposit: Input: 200
Output: Deposit successful. New balance: 1200.00
ATM Menu:
1. Check Balance
2. Deposit
3. Withdraw
4. Exit
Enter your option: Input: 3
Output: Enter amount to withdraw: Input: 500
Output: Withdrawal successful. New balance: 700.00
ATM Menu:
1. Check Balance
2. Deposit
3. Withdraw
4. Exit
Enter your option: Input: 3
Output: Enter amount to withdraw: Input: 800
Output: Insufficient funds or invalid amount.
ATM Menu:
1. Check Balance
2. Deposit
3. Withdraw
4. Exit
Enter your option: Input: 4
Output: Exiting ATM. Thank you!

💻 Password Validation
#include <stdio.h>
#include <string.h>

int main() {
  char password[50];
  int isValid = 0;

  do {
    printf("Enter your password: ");
    scanf("%s", password);

    if (strlen(password) >= 8) {
      isValid = 1;
      printf("Password accepted!n");
    } else {
      printf("Password must be at least 8 characters long.n");
      printf("Please try again.n");
    }
  } while (isValid == 0);

  return 0;
}
📤 Output:
Input: pass
Output: Password must be at least 8 characters long.
Output: Please try again.
Input: password123
Output: Password accepted!

💻 Sum of Numbers until Negative is Entered
#include <stdio.h>

int main() {
  int number, sum = 0;

  do {
    printf("Enter a number (negative to stop): ");
    scanf("%d", &number);

    if (number >= 0) {
      sum += number;
    }
  } while (number >= 0);

  printf("Sum of positive numbers entered: %dn", sum);

  return 0;
}
📤 Output:
Input: 10
Input: 5
Input: 2
Input: -1
Output: Sum of positive numbers entered: 17

💻 Continue until User Says 'No'
#include <stdio.h>

int main() {
    char answer;

    do {
        printf("Do you want to continue? (y/n): ");
        scanf(" %c", &answer);

        if (answer == 'y') {
            printf("Continuing...n");
        } else if (answer == 'n') {
            printf("Exiting...n");
        } else {
            printf("Invalid input. Please enter 'y' or 'n'.n");
        }

    } while (answer != 'n');

    return 0;
}
📤 Output:
Input: y
Output: Do you want to continue? (y/n): Continuing...
Input: z
Output: Do you want to continue? (y/n): Invalid input. Please enter 'y' or 'n'.
Input: Y
Output: Do you want to continue? (y/n): Invalid input. Please enter 'y' or 'n'.
Input: n
Output: Do you want to continue? (y/n): Exiting...

💻 Input Validation for Range
#include <stdio.h>

int main() {
  int number;
  int lower_bound = 10;
  int upper_bound = 20;

  do {
    printf("Enter a number between %d and %d: ", lower_bound, upper_bound);
    scanf("%d", &number);

    if (number < lower_bound || number > upper_bound) {
      printf("Invalid input. Please enter a number within the specified range.n");
    }
  } while (number < lower_bound || number > upper_bound);

  printf("You entered: %dn", number);

  return 0;
}
📤 Output:
Input: 5
Output: Enter a number between 10 and 20: 5
Invalid input. Please enter a number within the specified range.
Input: 25
Output: Enter a number between 10 and 20: 25
Invalid input. Please enter a number within the specified range.
Input: 15
Output: Enter a number between 10 and 20: 15
You entered: 15

💻 Input Validation for Positive Number
#include <stdio.h>

int main() {
  int number;

  do {
    printf("Enter a positive number: ");
    scanf("%d", &number);

    if (number <= 0) {
      printf("Invalid input. Please enter a positive number.n");
    }
  } while (number <= 0);

  printf("You entered: %dn", number);

  return 0;
}
📤 Output:
Input: -5
Output: Enter a positive number: Invalid input. Please enter a positive number.
Input: 0
Output: Enter a positive number: Invalid input. Please enter a positive number.
Input: 10
Output: Enter a positive number: You entered: 10

💻 Number Guessing Game
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main() {
    int secretNumber, guess;
    int attempts = 0;

    srand(time(0));
    secretNumber = rand() % 100 + 1;

    do {
        printf("Guess a number between 1 and 100: ");
        scanf("%d", &guess);
        attempts++;

        if (guess > secretNumber) {
            printf("Too high!n");
        } else if (guess < secretNumber) {
            printf("Too low!n");
        } else {
            printf("Congratulations! You guessed the number in %d attempts.n", attempts);
        }
    } while (guess != secretNumber);

    return 0;
}
📤 Output:
Guess a number between 1 and 100: Input: 50
Output: Too high!
Guess a number between 1 and 100: Input: 25
Output: Too low!
Guess a number between 1 and 100: Input: 37
Output: Too high!
Guess a number between 1 and 100: Input: 31
Output: Too low!
Guess a number between 1 and 100: Input: 34
Output: Too low!
Guess a number between 1 and 100: Input: 35
Output: Congratulations! You guessed the number in 6 attempts.

💻 Menu-Driven Calculator
#include <stdio.h>
#include <stdlib.h>

int main() {
    int choice;
    float num1, num2, result;

    do {
        printf("Menu:n");
        printf("1. Additionn");
        printf("2. Subtractionn");
        printf("3. Multiplicationn");
        printf("4. Divisionn");
        printf("0. Exitn");
        printf("Enter your choice: ");
        scanf("%d", &choice);

        if (choice >= 1 && choice <= 4) {
            printf("Enter two numbers: ");
            scanf("%f %f", &num1, &num2);
        }

        switch (choice) {
            case 1:
                result = num1 + num2;
                printf("Result: %fn", result);
                break;
            case 2:
                result = num1 - num2;
                printf("Result: %fn", result);
                break;
            case 3:
                result = num1 * num2;
                printf("Result: %fn", result);
                break;
            case 4:
                if (num2 != 0) {
                    result = num1 / num2;
                    printf("Result: %fn", result);
                } else {
                    printf("Cannot divide by zero.n");
                }
                break;
            case 0:
                printf("Exiting...n");
                break;
            default:
                printf("Invalid choice.n");
        }
    } while (choice != 0);

    return 0;
}
📤 Output:
Menu:
1. Addition
2. Subtraction
3. Multiplication
4. Division
0. Exit
Enter your choice: 1
Input: 1
Enter two numbers:
Input: 5.0 3.0
Output: Result: 8.000000
Menu:
1. Addition
2. Subtraction
3. Multiplication
4. Division
0. Exit
Enter your choice: 2
Input: 2
Enter two numbers:
Input: 10.0 4.0
Output: Result: 6.000000
Menu:
1. Addition
2. Subtraction
3. Multiplication
4. Division
0. Exit
Enter your choice: 3
Input: 3
Enter two numbers:
Input: 2.5 4.0
Output: Result: 10.000000
Menu:
1. Addition
2. Subtraction
3. Multiplication
4. Division
0. Exit
Enter your choice: 4
Input: 4
Enter two numbers:
Input: 10.0 2.0
Output: Result: 5.000000
Menu:
1. Addition
2. Subtraction
3. Multiplication
4. Division
0. Exit
Enter your choice: 4
Input: 4
Enter two numbers:
Input: 5.0 0.0
Output: Cannot divide by zero.
Menu:
1. Addition
2. Subtraction
3. Multiplication
4. Division
0. Exit
Enter your choice: 5
Input: 5
Output: Invalid choice.
Menu:
1. Addition
2. Subtraction
3. Multiplication
4. Division
0. Exit
Enter your choice: 0
Input: 0
Output: Exiting...

🔧 Loops - Do-While