uz
Feedback
C Programming Codes

C Programming Codes

Kanalga Telegram’da o‘tish

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

Ko'proq ko'rsatish

📈 Telegram kanali C Programming Codes analitikasi

C Programming Codes (@c_programming_codes) Ingliz til segmentidagi kanali faol ishtirokchi. Hozirda hamjamiyat 13 430 obunachidan iborat bo'lib, Texnologiyalar & Aralashmalar toifasida 9 534-o'rinni va Hindiston mintaqasida 32 075-o'rinni egallagan.

📊 Auditoriya ko‘rsatkichlari va dinamika

невідомо sanasidan buyon loyiha tez o‘sib, 13 430 obunachiga ega bo‘ldi.

11 Iyun, 2026 dagi oxirgi ma’lumotlarga ko‘ra kanal barqaror faollikka ega. Oxirgi 30 kunda obunachilar soni -239 ga, so‘nggi 24 soatda esa -9 ga o‘zgardi va umumiy qamrov yuqori darajada qolmoqda.

  • Tasdiqlash holati: Tasdiqlanmagan
  • Jalb etish (ER): Auditoriya o‘rtacha 9.78% darajada jalb etiladi. Nashrdan keyingi dastlabki 24 soatda kontent odatda umumiy obunachilar sonining N/A% ini tashkil etuvchi reaksiyalarni to‘playdi.
  • Post qamrovi: Har bir post o‘rtacha 0 marta ko‘riladi; birinchi sutkada odatda 0 ta ko‘rish yig‘iladi.
  • Reaksiyalar va o‘zaro ta’sir: Auditoriya faol: har bir postga o‘rtacha 0 ta reaksiya keladi.
  • Tematik yo‘nalishlar: Kontent input, string, scanf("%d, array, element kabi asosiy mavzularga jamlangan.

📝 Tavsif va kontent siyosati

Muallif resursni shaxsiy fikrni ifoda etish maydoni sifatida ta’riflaydi:
C Programming Codes || Quizzes || DSA Learn along with the community Any queries admin - @Pradeep_saii

Yuqori yangilanish chastotasi (oxirgi ma’lumot 12 Iyun, 2026 da olingan) sababli kanal doimo dolzarb va katta qamrovli bo‘lib qoladi. Analitika auditoriya kontent bilan faol hamkorlik qilishini, uni Texnologiyalar & Aralashmalar toifasidagi muhim ta’sir nuqtasiga aylantirishini ko‘rsatadi.

13 430
Obunachilar
-924 soatlar
-577 kunlar
-23930 kunlar
Postlar arxiv
💻 Grade Calculator Using Switch
#include <stdio.h>

int main() {
  int marks;

  printf("Enter your marks: ");
  scanf("%d", &marks);

  switch (marks / 10) {
    case 10:
    case 9:
      printf("Grade: An");
      break;
    case 8:
      printf("Grade: Bn");
      break;
    case 7:
      printf("Grade: Cn");
      break;
    case 6:
      printf("Grade: Dn");
      break;
    default:
      printf("Grade: Fn");
      break;
  }

  return 0;
}
📤 Output:
Input: 95
Output: Grade: A

Input: 82
Output: Grade: B

Input: 78
Output: Grade: C

Input: 61
Output: Grade: D

Input: 50
Output: Grade: F

Input: 100
Output: Grade: A

Input: 0
Output: Grade: F

💻 Menu-Driven Program for Shapes
#include <stdio.h>

int main() {
    int choice;
    float radius, side, length, width, base, height;

    printf("Menu:n");
    printf("1. Calculate Area of Circlen");
    printf("2. Calculate Area of Squaren");
    printf("3. Calculate Area of Rectanglen");
    printf("4. Calculate Area of Trianglen");
    printf("Enter your choice: ");
    scanf("%d", &choice);

    switch (choice) {
        case 1:
            printf("Enter the radius of the circle: ");
            scanf("%f", &radius);
            printf("Area of Circle: %.2fn", 3.14159 * radius * radius);
            break;
        case 2:
            printf("Enter the side of the square: ");
            scanf("%f", &side);
            printf("Area of Square: %.2fn", side * side);
            break;
        case 3:
            printf("Enter the length and width of the rectangle: ");
            scanf("%f %f", &length, &width);
            printf("Area of Rectangle: %.2fn", length * width);
            break;
        case 4:
            printf("Enter the base and height of the triangle: ");
            scanf("%f %f", &base, &height);
            printf("Area of Triangle: %.2fn", 0.5 * base * height);
            break;
        default:
            printf("Invalid choice!n");
    }

    return 0;
}
📤 Output:
Menu:
1. Calculate Area of Circle
2. Calculate Area of Square
3. Calculate Area of Rectangle
4. Calculate Area of Triangle
Enter your choice: 1
Input: 5
Enter the radius of the circle: Area of Circle: 78.54
Menu:
1. Calculate Area of Circle
2. Calculate Area of Square
3. Calculate Area of Rectangle
4. Calculate Area of Triangle
Enter your choice: 2
Input: 7
Enter the side of the square: Area of Square: 49.00
Menu:
1. Calculate Area of Circle
2. Calculate Area of Square
3. Calculate Area of Rectangle
4. Calculate Area of Triangle
Enter your choice: 3
Input: 4 6
Enter the length and width of the rectangle: Area of Rectangle: 24.00
Menu:
1. Calculate Area of Circle
2. Calculate Area of Square
3. Calculate Area of Rectangle
4. Calculate Area of Triangle
Enter your choice: 4
Input: 8 3
Enter the base and height of the triangle: Area of Triangle: 12.00
Menu:
1. Calculate Area of Circle
2. Calculate Area of Square
3. Calculate Area of Rectangle
4. Calculate Area of Triangle
Enter your choice: 5
Input: 5
Invalid choice!

💻 Traffic Light Simulator
#include <stdio.h>

int main() {
    char light;

    printf("Enter a traffic light color (R, Y, G): ");
    scanf(" %c", &light);

    switch (light) {
        case 'R':
            printf("STOP!n");
            break;
        case 'Y':
            printf("CAUTION! Prepare to stop.n");
            break;
        case 'G':
            printf("GO!n");
            break;
        default:
            printf("Invalid input.n");
    }

    return 0;
}
📤 Output:
Input: R
Output: Enter a traffic light color (R, Y, G): STOP!

Input: Y
Output: Enter a traffic light color (R, Y, G): CAUTION! Prepare to stop.

Input: G
Output: Enter a traffic light color (R, Y, G): GO!

Input: B
Output: Enter a traffic light color (R, Y, G): Invalid input.

💻 Vowel or Consonant Using Switch
#include <stdio.h>

int main() {
    char ch;

    printf("Enter an alphabet: ");
    scanf(" %c", &ch);

    switch (ch) {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':
        case 'A':
        case 'E':
        case 'I':
        case 'O':
        case 'U':
            printf("%c is a vowel.n", ch);
            break;
        default:
            printf("%c is a consonant.n", ch);
    }

    return 0;
}
📤 Output:
Input: a
Output: a is a vowel.

Input: b
Output: b is a consonant.

Input: A
Output: A is a vowel.

Input: Z
Output: Z is a consonant.

Input: e
Output: e is a vowel.

Input: q
Output: q is a consonant.

💻 Arithmetic Operations Using Switch
#include <stdio.h>

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

    printf("Enter first number: ");
    scanf("%d", &num1);

    printf("Enter second number: ");
    scanf("%d", &num2);

    printf("Choose an operation:n");
    printf("1. Additionn");
    printf("2. Subtractionn");
    printf("3. Multiplicationn");
    printf("4. Divisionn");
    printf("Enter your choice (1-4): ");
    scanf("%d", &choice);

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

    return 0;
}
📤 Output:
Input: 10
Input: 5
Input: 1
Output: Result: 15

Input: 10
Input: 5
Input: 2
Output: Result: 5

Input: 10
Input: 5
Input: 3
Output: Result: 50

Input: 10
Input: 5
Input: 4
Output: Result: 2

Input: 10
Input: 0
Input: 4
Output: Error: Division by zero!

Input: 10
Input: 5
Input: 5
Output: Invalid choice!

💻 Number to Month Name Converter
#include <stdio.h>

int main() {
  int month_number;

  printf("Enter a month number (1-12): ");
  scanf("%d", &month_number);

  switch (month_number) {
    case 1:
      printf("Januaryn");
      break;
    case 2:
      printf("Februaryn");
      break;
    case 3:
      printf("Marchn");
      break;
    case 4:
      printf("Apriln");
      break;
    case 5:
      printf("Mayn");
      break;
    case 6:
      printf("Junen");
      break;
    case 7:
      printf("Julyn");
      break;
    case 8:
      printf("Augustn");
      break;
    case 9:
      printf("Septembern");
      break;
    case 10:
      printf("Octobern");
      break;
    case 11:
      printf("Novembern");
      break;
    case 12:
      printf("Decembern");
      break;
    default:
      printf("Invalid month number. Please enter a number between 1 and 12.n");
  }

  return 0;
}
📤 Output:
Enter a month number (1-12): 1
January

Enter a month number (1-12): 5
May

Enter a month number (1-12): 12
December

Enter a month number (1-12): 0
Invalid month number. Please enter a number between 1 and 12.

Enter a month number (1-12): 13
Invalid month number. Please enter a number between 1 and 12.

💻 Simple Calculator Using Switch
#include <stdio.h>

int main() {
    char operator;
    float num1, num2, result;

    printf("Enter operator (+, -, *, /): ");
    scanf(" %c", &operator);

    printf("Enter two numbers: ");
    scanf("%f %f", &num1, &num2);

    switch (operator) {
        case '+':
            result = num1 + num2;
            printf("%.2f + %.2f = %.2fn", num1, num2, result);
            break;
        case '-':
            result = num1 - num2;
            printf("%.2f - %.2f = %.2fn", num1, num2, result);
            break;
        case '*':
            result = num1 * num2;
            printf("%.2f * %.2f = %.2fn", num1, num2, result);
            break;
        case '/':
            if (num2 == 0) {
                printf("Error: Division by zeron");
            } else {
                result = num1 / num2;
                printf("%.2f / %.2f = %.2fn", num1, num2, result);
            }
            break;
        default:
            printf("Error: Invalid operatorn");
    }

    return 0;
}
📤 Output:
Input: +
Input: 10.5 5.2
Output: 10.50 + 5.20 = 15.70

Input: -
Input: 20.0 7.5
Output: 20.00 - 7.50 = 12.50

Input: *
Input: 8.0 3.0
Output: 8.00 * 3.00 = 24.00

Input: /
Input: 15.0 3.0
Output: 15.00 / 3.00 = 5.00

Input: /
Input: 10.0 0.0
Output: Error: Division by zero

Input: %
Input: 5.0 2.0
Output: Error: Invalid operator

💻 Day of the Week Using Switch
#include <stdio.h>

int main() {
  int day;

  printf("Enter a number (1-7): ");
  scanf("%d", &day);

  switch (day) {
    case 1:
      printf("Sundayn");
      break;
    case 2:
      printf("Mondayn");
      break;
    case 3:
      printf("Tuesdayn");
      break;
    case 4:
      printf("Wednesdayn");
      break;
    case 5:
      printf("Thursdayn");
      break;
    case 6:
      printf("Fridayn");
      break;
    case 7:
      printf("Saturdayn");
      break;
    default:
      printf("Invalid input!n");
  }

  return 0;
}
📤 Output:
Input: 1
Output: Sunday

Input: 4
Output: Wednesday

Input: 7
Output: Saturday

Input: 0
Output: Invalid input!

Input: 8
Output: Invalid input!

🔧 Conditional Statements - Switch Case

💻 Arithmetic Operation Menu
#include <stdio.h>

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

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

    printf("Choose an operation:n");
    printf("1. Additionn");
    printf("2. Subtractionn");
    printf("3. Multiplicationn");
    printf("4. Divisionn");
    printf("Enter your choice (1-4): ");
    scanf("%d", &choice);

    if (choice == 1) {
        result = num1 + num2;
        printf("Result: %dn", result);
    } else if (choice == 2) {
        result = num1 - num2;
        printf("Result: %dn", result);
    } else if (choice == 3) {
        result = num1 * num2;
        printf("Result: %dn", result);
    } else if (choice == 4) {
        if (num2 == 0) {
            printf("Cannot divide by zero.n");
        } else {
            result = num1 / num2;
            printf("Result: %dn", result);
        }
    } else {
        printf("Invalid choice.n");
    }

    return 0;
}
📤 Output:
Input: 10 5
Output: Enter two numbers: Choose an operation:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter your choice (1-4): Result: 15

Input: 10 5
Output: Enter two numbers: Choose an operation:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter your choice (1-4): Result: 5

Input: 10 5
Output: Enter two numbers: Choose an operation:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter your choice (1-4): Result: 50

Input: 10 5
Output: Enter two numbers: Choose an operation:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter your choice (1-4): Result: 2

Input: 10 0
Output: Enter two numbers: Choose an operation:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter your choice (1-4): Cannot divide by zero.

Input: 10 5
Output: Enter two numbers: Choose an operation:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter your choice (1-4): Invalid choice.

💻 BMI Category Calculator
#include <stdio.h>

int main() {
    float weight, height, bmi;

    printf("Enter your weight in kilograms: ");
    scanf("%f", &weight);

    printf("Enter your height in meters: ");
    scanf("%f", &height);

    bmi = weight / (height * height);

    printf("Your BMI is: %.2fn", bmi);

    if (bmi < 18.5) {
        printf("Category: Underweightn");
    } else if (bmi < 25) {
        printf("Category: Normal weightn");
    } else if (bmi < 30) {
        printf("Category: Overweightn");
    } else {
        printf("Category: Obesen");
    }

    return 0;
}
📤 Output:
Input: 70
Input: 1.75
Output: Your BMI is: 22.86
Output: Category: Normal weight

💻 Find Roots of Quadratic Equation
#include <stdio.h>
#include <math.h>

int main() {
    float a, b, c, discriminant, root1, root2, realPart, imaginaryPart;

    printf("Enter coefficients a, b and c: ");
    scanf("%f %f %f", &a, &b, &c);

    discriminant = b * b - 4 * a * c;

    if (discriminant > 0) {
        root1 = (-b + sqrt(discriminant)) / (2 * a);
        root2 = (-b - sqrt(discriminant)) / (2 * a);
        printf("Root 1 = %.2f and Root 2 = %.2f", root1, root2);
    } else if (discriminant == 0) {
        root1 = root2 = -b / (2 * a);
        printf("Root 1 = Root 2 = %.2f;", root1);
    } else {
        realPart = -b / (2 * a);
        imaginaryPart = sqrt(-discriminant) / (2 * a);
        printf("Root 1 = %.2f+%.2fi and Root 2 = %.2f-%.2fi", realPart, imaginaryPart, realPart, imaginaryPart);
    }

    return 0;
}
📤 Output:
Input: 1 5 6
Output: Root 1 = -2.00 and Root 2 = -3.00
Input: 1 2 1
Output: Root 1 = Root 2 = -1.00;
Input: 1 2 5
Output: Root 1 = -1.00+2.00i and Root 2 = -1.00-2.00i

💻 Check Character Type (Alphabet, Digit, Special)
#include <stdio.h>

int main() {
    char ch;

    printf("Enter a character: ");
    scanf(" %c", &ch);

    if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
        printf("Alphabetn");
    } else if (ch >= '0' && ch <= '9') {
        printf("Digitn");
    } else {
        printf("Special charactern");
    }

    return 0;
}
📤 Output:
Input: A
Output: Alphabet

Input: 5
Output: Digit

Input: $
Output: Special character

Input: a
Output: Alphabet

💻 Number to Word Converter (1-10)
#include <stdio.h>

int main() {
  int number;

  printf("Enter a number between 1 and 10: ");
  scanf("%d", &number);

  if (number == 1) {
    printf("Onen");
  } else if (number == 2) {
    printf("Twon");
  } else if (number == 3) {
    printf("Threen");
  } else if (number == 4) {
    printf("Fourn");
  } else if (number == 5) {
    printf("Fiven");
  } else if (number == 6) {
    printf("Sixn");
  } else if (number == 7) {
    printf("Sevenn");
  } else if (number == 8) {
    printf("Eightn");
  } else if (number == 9) {
    printf("Ninen");
  } else if (number == 10) {
    printf("Tenn");
  } else {
    printf("Invalid input. Please enter a number between 1 and 10.n");
  }

  return 0;
}
📤 Output:
Enter a number between 1 and 10: 5
Five

Enter a number between 1 and 10: 11
Invalid input. Please enter a number between 1 and 10.

Enter a number between 1 and 10: 1
One

Enter a number between 1 and 10: 10
Ten

💻 Day of the Week Based on Number (1-7)
#include <stdio.h>

int main() {
    int dayNumber;

    printf("Enter a number (1-7): ");
    scanf("%d", &dayNumber);

    if (dayNumber == 1) {
        printf("Sundayn");
    } else if (dayNumber == 2) {
        printf("Mondayn");
    } else if (dayNumber == 3) {
        printf("Tuesdayn");
    } else if (dayNumber == 4) {
        printf("Wednesdayn");
    } else if (dayNumber == 5) {
        printf("Thursdayn");
    } else if (dayNumber == 6) {
        printf("Fridayn");
    } else if (dayNumber == 7) {
        printf("Saturdayn");
    } else {
        printf("Invalid input. Please enter a number between 1 and 7.n");
    }

    return 0;
}
📤 Output:
Enter a number (1-7): 1
Sunday

Enter a number (1-7): 4
Wednesday

Enter a number (1-7): 7
Saturday

Enter a number (1-7): 0
Invalid input. Please enter a number between 1 and 7.

Enter a number (1-7): 8
Invalid input. Please enter a number between 1 and 7.

Enter a number (1-7): 5
Thursday

💻 Calculate Electricity Bill Based on Units
#include <stdio.h>

int main() {
  int units;
  float bill;

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

  if (units <= 50) {
    bill = units * 0.50;
  } else if (units <= 150) {
    bill = 25 + (units - 50) * 0.75;
  } else if (units <= 250) {
    bill = 100 + (units - 150) * 1.00;
  } else {
    bill = 200 + (units - 250) * 1.25;
  }

  printf("Electricity bill: Rs. %.2fn", bill);

  return 0;
}
📤 Output:
Input: 30
Output: Electricity bill: Rs. 15.00
Input: 100
Output: Electricity bill: Rs. 62.50
Input: 200
Output: Electricity bill: Rs. 150.00
Input: 300
Output: Electricity bill: Rs. 262.50

💻 Check Triangle Type (Equilateral, Isosceles, Scalene)
#include <stdio.h>

int main() {
    int side1, side2, side3;

    printf("Enter the lengths of three sides of a triangle: ");
    scanf("%d %d %d", &side1, &side2, &side3);

    if (side1 == side2 && side2 == side3) {
        printf("Equilateral trianglen");
    } else if (side1 == side2 || side1 == side3 || side2 == side3) {
        printf("Isosceles trianglen");
    } else {
        printf("Scalene trianglen");
    }

    return 0;
}
📤 Output:
Input: 5 5 5
Output: Enter the lengths of three sides of a triangle: Equilateral triangle

Input: 3 4 5
Output: Enter the lengths of three sides of a triangle: Scalene triangle

Input: 2 2 3
Output: Enter the lengths of three sides of a triangle: Isosceles triangle

💻 Simple Grade Calculator (A, B, C, D, F)
#include <stdio.h>

int main() {
  int score;

  printf("Enter your score: ");
  scanf("%d", &score);

  if (score >= 90) {
    printf("Grade: An");
  } else if (score >= 80) {
    printf("Grade: Bn");
  } else if (score >= 70) {
    printf("Grade: Cn");
  } else if (score >= 60) {
    printf("Grade: Dn");
  } else {
    printf("Grade: Fn");
  }

  return 0;
}
📤 Output:
Input: 95
Output: Grade: A

Input: 82
Output: Grade: B

Input: 75
Output: Grade: C

Input: 61
Output: Grade: D

Input: 50
Output: Grade: F

💻 Find Maximum of Three Numbers
#include <stdio.h>

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

  printf("Enter three numbers: ");
  scanf("%d %d %d", &num1, &num2, &num3);

  if (num1 >= num2 && num1 >= num3) {
    printf("Maximum number is: %d", num1);
  } else if (num2 >= num1 && num2 >= num3) {
    printf("Maximum number is: %d", num2);
  } else {
    printf("Maximum number is: %d", num3);
  }

  printf("n");
  return 0;
}
📤 Output:
Input: 10 5 8
Output: Enter three numbers: Maximum number is: 10

Input: 5 12 3
Output: Enter three numbers: Maximum number is: 12

Input: 2 7 15
Output: Enter three numbers: Maximum number is: 15

🔧 Conditional Statements - else-if ladder

C Programming Codes - Telegram kanali @c_programming_codes statistikasi va tahlili