uz
Feedback
C Programming Language || Hands On Coding

C Programming Language || Hands On Coding

Kanalga Telegram’da o‘tish

Hands-on C programming language challenges for beginners. Learn building logic by solving programs. Owner: @Pradeep_saii

Ko'proq ko'rsatish

📈 Telegram kanali C Programming Language || Hands On Coding analitikasi

C Programming Language || Hands On Coding (@c_programming_language_coding) Ingliz til segmentidagi kanali faol ishtirokchi. Hozirda hamjamiyat 12 822 obunachidan iborat bo'lib, Texnologiyalar & Aralashmalar toifasida 9 562-o'rinni va Hindiston mintaqasida 31 207-o'rinni egallagan.

📊 Auditoriya ko‘rsatkichlari va dinamika

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

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

  • Tasdiqlash holati: Tasdiqlanmagan
  • Jalb etish (ER): Auditoriya o‘rtacha 12.56% darajada jalb etiladi. Nashrdan keyingi dastlabki 24 soatda kontent odatda umumiy obunachilar sonining 2.42% ini tashkil etuvchi reaksiyalarni to‘playdi.
  • Post qamrovi: Har bir post o‘rtacha 1 612 marta ko‘riladi; birinchi sutkada odatda 310 ta ko‘rish yig‘iladi.
  • Reaksiyalar va o‘zaro ta’sir: Auditoriya faol: har bir postga o‘rtacha 4 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:
Hands-on C programming language challenges for beginners. Learn building logic by solving programs. Owner: @Pradeep_saii

Yuqori yangilanish chastotasi (oxirgi ma’lumot 27 Avgust, 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.

12 822
Obunachilar
-224 soatlar
-357 kunlar
-21030 kunlar
Postlar arxiv
💻 Union for Memory Efficient Storage
#include <stdio.h>

union Data {
    int i;
    float f;
    char str[20];
};

int main() {
    union Data data;

    printf("Enter an integer: ");
    scanf("%d", &data.i);
    printf("Integer: %dn", data.i);

    printf("Enter a float: ");
    scanf("%f", &data.f);
    printf("Float: %fn", data.f);

    printf("Enter a string: ");
    scanf("%s", data.str);
    printf("String: %sn", data.str);

    printf("Integer: %dn", data.i);
    printf("Float: %fn", data.f);
    printf("String: %sn", data.str);

    return 0;
}
📤 Output:
Input: 10
Output: Enter an integer: Integer: 10
Input: 3.14
Output: Enter a float: Float: 3.140000
Input: Hello
Output: Enter a string: String: Hello
Output: Integer: 1819043144
Output: Float: 7.006492
Output: String: Hello

💻 Union for Type Conversion
#include <stdio.h>

union Data {
    int i;
    float f;
    char str[20];
};

int main() {
    union Data data;

    printf("Enter an integer: ");
    scanf("%d", &data.i);
    printf("Integer: %dn", data.i);

    printf("Enter a float: ");
    scanf("%f", &data.f);
    printf("Float: %fn", data.f);

    printf("Enter a string: ");
    scanf("%s", data.str);
    printf("String: %sn", data.str);

    printf("Integer: %dn", data.i);
    printf("Float: %fn", data.f);

    return 0;
}
📤 Output:
Input: 10
Output: Enter an integer: Integer: 10
Input: 3.14
Output: Enter a float: Float: 3.140000
Input: hello
Output: Enter a string: String: hello
Output: Integer: 188628848
Output: Float: 0.000000

💻 Pointer to Structure
#include <stdio.h>
#include <string.h>

struct Person {
    char name[50];
    int age;
};

int main() {
    struct Person person1;
    struct Person *ptr;

    strcpy(person1.name, "John Doe");
    person1.age = 30;

    ptr = &person1;

    printf("Name: %sn", ptr->name);
    printf("Age: %dn", ptr->age);

    return 0;
}
📤 Output:
Name: John Doe
Age: 30

💻 Array of Structures
#include <stdio.h>

#include <string.h>

struct Student {
    char name[50];
    int age;
    float gpa;
};

int main() {
    int numStudents;

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

    struct Student students[numStudents];

    for (int i = 0; i < numStudents; i++) {
        printf("nEnter details for student %d:n", i + 1);

        printf("Name: ");
        scanf(" %[^n]s", students[i].name);

        printf("Age: ");
        scanf("%d", &students[i].age);

        printf("GPA: ");
        scanf("%f", &students[i].gpa);
    }

    printf("nStudent Details:n");
    for (int i = 0; i < numStudents; i++) {
        printf("Student %d:n", i + 1);
        printf("Name: %sn", students[i].name);
        printf("Age: %dn", students[i].age);
        printf("GPA: %.2fn", students[i].gpa);
    }

    return 0;
}
📤 Output:
Input: 2
Input: Alice Smith
Input: 20
Input: 3.85
Input: Bob Johnson
Input: 22
Input: 3.50
Output: Enter the number of students:
Enter details for student 1:
Name: Age: GPA:
Enter details for student 2:
Name: Age: GPA:

Student Details:
Student 1:
Name: Alice Smith
Age: 20
GPA: 3.85
Student 2:
Name: Bob Johnson
Age: 22
GPA: 3.50

💻 Nested Structures
#include <stdio.h>

struct Date {
    int day;
    int month;
    int year;
};

struct Student {
    char name[50];
    int rollNumber;
    struct Date birthday;
};

int main() {
    struct Student student1;

    printf("Enter student name: ");
    scanf("%s", student1.name);

    printf("Enter roll number: ");
    scanf("%d", &student1.rollNumber);

    printf("Enter birthday (day month year): ");
    scanf("%d %d %d", &student1.birthday.day, &student1.birthday.month, &student1.birthday.year);

    printf("nStudent Details:n");
    printf("Name: %sn", student1.name);
    printf("Roll Number: %dn", student1.rollNumber);
    printf("Birthday: %d/%d/%dn", student1.birthday.day, student1.birthday.month, student1.birthday.year);

    return 0;
}
📤 Output:
Input: JohnDoe
Input: 123
Input: 15 08 2000
Output: Enter student name: Enter roll number: Enter birthday (day month year):
Student Details:
Name: JohnDoe
Roll Number: 123
Birthday: 15/8/2000

💻 Circle Area and Circumference
#include <stdio.h>
#define PI 3.14159

struct Circle {
    float radius;
};

int main() {
    struct Circle myCircle;

    printf("Enter the radius of the circle: ");
    scanf("%f", &myCircle.radius);

    float area = PI * myCircle.radius * myCircle.radius;
    float circumference = 2 * PI * myCircle.radius;

    printf("Area of the circle: %.2fn", area);
    printf("Circumference of the circle: %.2fn", circumference);

    return 0;
}
📤 Output:
Input: 5
Output: Enter the radius of the circle: Area of the circle: 78.54
Circumference of the circle: 31.42

💻 Rectangle Area and Perimeter
#include <stdio.h>

struct Rectangle {
    float length;
    float width;
};

int main() {
    struct Rectangle myRectangle;

    printf("Enter the length of the rectangle: ");
    scanf("%f", &myRectangle.length);

    printf("Enter the width of the rectangle: ");
    scanf("%f", &myRectangle.width);

    float area = myRectangle.length * myRectangle.width;
    float perimeter = 2 * (myRectangle.length + myRectangle.width);

    printf("Area of the rectangle: %.2fn", area);
    printf("Perimeter of the rectangle: %.2fn", perimeter);

    return 0;
}
📤 Output:
Input: 5.0
Input: 3.0
Output: Area of the rectangle: 15.00
Output: Perimeter of the rectangle: 16.00

💻 Bank Account Management
#include <stdio.h>
#include <string.h>

struct Account {
    int accountNumber;
    char accountHolderName[50];
    float balance;
};

int main() {
    struct Account myAccount;

    printf("Enter account number: ");
    scanf("%d", &myAccount.accountNumber);

    printf("Enter account holder name: ");
    scanf(" %[^n]s", myAccount.accountHolderName);

    printf("Enter initial balance: ");
    scanf("%f", &myAccount.balance);

    printf("nAccount Details:n");
    printf("Account Number: %dn", myAccount.accountNumber);
    printf("Account Holder Name: %sn", myAccount.accountHolderName);
    printf("Balance: %.2fn", myAccount.balance);

    float depositAmount;
    printf("nEnter amount to deposit: ");
    scanf("%f", &depositAmount);
    myAccount.balance += depositAmount;
    printf("New balance after deposit: %.2fn", myAccount.balance);

    float withdrawalAmount;
    printf("nEnter amount to withdraw: ");
    scanf("%f", &withdrawalAmount);
    if (withdrawalAmount <= myAccount.balance) {
        myAccount.balance -= withdrawalAmount;
        printf("New balance after withdrawal: %.2fn", myAccount.balance);
    } else {
        printf("Insufficient balance.n");
    }

    return 0;
}
📤 Output:
Input: 12345
Input: John Doe
Input: 1000.00
Output: Enter account number: Enter account holder name: Enter initial balance:
Account Details:
Account Number: 12345
Account Holder Name: John Doe
Balance: 1000.00
Enter amount to deposit: Input: 500.00
Output: New balance after deposit: 1500.00
Enter amount to withdraw: Input: 200.00
Output: New balance after withdrawal: 1300.00

💻 Book Library System
#include <stdio.h>
#include <string.h>

struct Book {
    char title[50];
    char author[50];
    int book_id;
};

int main() {
    struct Book book1;

    printf("Enter book title: ");
    scanf(" %[^n]s", book1.title);

    printf("Enter author name: ");
    scanf(" %[^n]s", book1.author);

    printf("Enter book ID: ");
    scanf("%d", &book1.book_id);

    printf("nBook Details:n");
    printf("Title: %sn", book1.title);
    printf("Author: %sn", book1.author);
    printf("Book ID: %dn", book1.book_id);

    return 0;
}
📤 Output:
Input: The Lord of the Rings
Input: J.R.R. Tolkien
Input: 12345
Output: Enter book title: Enter author name: Enter book ID:
Book Details:
Title: The Lord of the Rings
Author: J.R.R. Tolkien
Book ID: 12345

💻 Date Validation and Operations
#include <stdio.h>
#include <stdbool.h>

typedef struct {
    int day;
    int month;
    int year;
} Date;

bool isValidDate(Date date) {
    if (date.year < 1 || date.month < 1 || date.month > 12 || date.day < 1) {
        return false;
    }

    int daysInMonth[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    if ((date.year % 4 == 0 && date.year % 100 != 0) || (date.year % 400 == 0)) {
        daysInMonth[2] = 29;
    }

    if (date.day > daysInMonth[date.month]) {
        return false;
    }

    return true;
}

Date addDays(Date date, int daysToAdd) {
    Date newDate = date;
    int daysInMonth[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    if ((newDate.year % 4 == 0 && newDate.year % 100 != 0) || (newDate.year % 400 == 0)) {
        daysInMonth[2] = 29;
    }

    newDate.day += daysToAdd;

    while (newDate.day > daysInMonth[newDate.month]) {
        newDate.day -= daysInMonth[newDate.month];
        newDate.month++;
        if (newDate.month > 12) {
            newDate.month = 1;
            newDate.year++;
            if ((newDate.year % 4 == 0 && newDate.year % 100 != 0) || (newDate.year % 400 == 0)) {
                daysInMonth[2] = 29;
            } else {
                daysInMonth[2] = 28;
            }
        }
    }

    return newDate;
}

int main() {
    Date myDate;
    int daysToAdd;

    printf("Enter date (day month year): ");
    scanf("%d %d %d", &myDate.day, &myDate.month, &myDate.year);

    if (!isValidDate(myDate)) {
        printf("Invalid date!n");
        return 1;
    }

    printf("Enter number of days to add: ");
    scanf("%d", &daysToAdd);

    Date newDate = addDays(myDate, daysToAdd);

    printf("New date: %d/%d/%dn", newDate.day, newDate.month, newDate.year);

    return 0;
}
📤 Output:
Input: 28 2 2023
Output: Enter date (day month year): Enter number of days to add: 5
New date: 5/3/2023
Input: 31 12 2023
Output: Enter date (day month year): Enter number of days to add: 1
New date: 1/1/2024
Input: 29 2 2024
Output: Enter date (day month year): Enter number of days to add: 1
New date: 1/3/2024
Input: 1 1 2024
Output: Enter date (day month year): Enter number of days to add: 366
New date: 1/1/2025
Input: 31 4 2023
Output: Enter date (day month year): Invalid date!

💻 Time Addition and Subtraction
#include <stdio.h>

struct Time {
    int hours;
    int minutes;
    int seconds;
};

int main() {
    struct Time t1, t2, sum, diff;

    printf("Enter first time (hours minutes seconds): ");
    scanf("%d %d %d", &t1.hours, &t1.minutes, &t1.seconds);

    printf("Enter second time (hours minutes seconds): ");
    scanf("%d %d %d", &t2.hours, &t2.minutes, &t2.seconds);

    // Time Addition
    sum.seconds = t1.seconds + t2.seconds;
    sum.minutes = t1.minutes + t2.minutes + sum.seconds / 60;
    sum.hours = t1.hours + t2.hours + sum.minutes / 60;

    sum.minutes %= 60;
    sum.seconds %= 60;
    sum.hours %= 24;

    printf("Sum of times: %d:%d:%dn", sum.hours, sum.minutes, sum.seconds);

    // Time Subtraction (t1 - t2)
    int t1_sec = t1.hours * 3600 + t1.minutes * 60 + t1.seconds;
    int t2_sec = t2.hours * 3600 + t2.minutes * 60 + t2.seconds;
    int diff_sec = t1_sec - t2_sec;

    if (diff_sec < 0) {
        diff_sec = -diff_sec; //absolute difference
    }

    diff.hours = diff_sec / 3600;
    diff.minutes = (diff_sec % 3600) / 60;
    diff.seconds = (diff_sec % 3600) % 60;

    printf("Difference of times: %d:%d:%dn", diff.hours, diff.minutes, diff.seconds);

    return 0;
}
📤 Output:
Input: 10 30 45
Input: 5 15 20
Output: Sum of times: 15:46:5
Output: Difference of times: 5:15:25

💻 Distance Between Two Points
#include <stdio.h>
#include <math.h>

struct Point {
    float x;
    float y;
};

int main() {
    struct Point p1, p2;
    float distance;

    printf("Enter x and y coordinates for point 1: ");
    scanf("%f %f", &p1.x, &p1.y);

    printf("Enter x and y coordinates for point 2: ");
    scanf("%f %f", &p2.x, &p2.y);

    distance = sqrt(pow(p2.x - p1.x, 2) + pow(p2.y - p1.y, 2));

    printf("Distance between the two points: %fn", distance);

    return 0;
}
📤 Output:
Input: 1.0 2.0
Input: 4.0 6.0
Output: Distance between the two points: 5.000000

💻 Complex Number Operations
#include <stdio.h>

typedef struct {
    float real;
    float imaginary;
} Complex;

Complex add(Complex a, Complex b) {
    Complex result;
    result.real = a.real + b.real;
    result.imaginary = a.imaginary + b.imaginary;
    return result;
}

Complex subtract(Complex a, Complex b) {
    Complex result;
    result.real = a.real - b.real;
    result.imaginary = a.imaginary - b.imaginary;
    return result;
}

int main() {
    Complex num1, num2, sum, difference;

    printf("Enter real and imaginary parts of first complex number: ");
    scanf("%f %f", &num1.real, &num1.imaginary);

    printf("Enter real and imaginary parts of second complex number: ");
    scanf("%f %f", &num2.real, &num2.imaginary);

    sum = add(num1, num2);
    printf("Sum = %.2f + %.2fin", sum.real, sum.imaginary);

    difference = subtract(num1, num2);
    printf("Difference = %.2f + %.2fin", difference.real, difference.imaginary);

    return 0;
}
📤 Output:
Input: 3.4 5.2
Input: -1.1 2.5
Output: Enter real and imaginary parts of first complex number: Enter real and imaginary parts of second complex number: Sum = 2.30 + 7.70i
Output: Difference = 4.50 + 2.70i

💻 Employee Database Management
#include <stdio.h>
#include <string.h>

struct Employee {
    int id;
    char name[50];
    float salary;
};

int main() {
    struct Employee emp;

    printf("Enter employee ID: ");
    scanf("%d", &emp.id);
    printf("Enter employee name: ");
    scanf(" %[^n]s", emp.name);
    printf("Enter employee salary: ");
    scanf("%f", &emp.salary);

    printf("nEmployee Details:n");
    printf("ID: %dn", emp.id);
    printf("Name: %sn", emp.name);
    printf("Salary: %.2fn", emp.salary);

    return 0;
}
📤 Output:
Input: 123
Input: John Doe
Input: 60000.50
Output: Enter employee ID: Enter employee name: Enter employee salary:
Employee Details:
ID: 123
Name: John Doe
Salary: 60000.50

💻 Student Record System
#include <stdio.h>
#include <string.h>

struct Student {
    char name[50];
    int rollNumber;
    float marks;
};

int main() {
    struct Student student1;

    printf("Enter student name: ");
    scanf("%s", student1.name);

    printf("Enter roll number: ");
    scanf("%d", &student1.rollNumber);

    printf("Enter marks: ");
    scanf("%f", &student1.marks);

    printf("nStudent Details:n");
    printf("Name: %sn", student1.name);
    printf("Roll Number: %dn", student1.rollNumber);
    printf("Marks: %.2fn", student1.marks);

    return 0;
}
📤 Output:
Input: John
Input: 123
Input: 85.5
Output: Enter student name: Enter roll number: Enter marks:
Student Details:
Name: John
Roll Number: 123
Marks: 85.50

🔧 Structures and Unions

💻 Array of Structure Pointers
#include <stdio.h>
#include <stdlib.h>

struct Student {
    int id;
    char name[50];
    float gpa;
};

int main() {
    int n;

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

    struct Student *students[n]; // Array of structure pointers

    // Allocate memory for each student and get input
    for (int i = 0; i < n; i++) {
        students[i] = (struct Student*)malloc(sizeof(struct Student));

        printf("Enter details for student %d:n", i + 1);

        printf("ID: ");
        scanf("%d", &(students[i]->id));

        printf("Name: ");
        scanf(" %[^n]", students[i]->name); // Read name with spaces

        printf("GPA: ");
        scanf("%f", &(students[i]->gpa));
    }

    // Print the student details
    printf("nStudent Details:n");
    for (int i = 0; i < n; i++) {
        printf("Student %d:n", i + 1);
        printf("ID: %dn", students[i]->id);
        printf("Name: %sn", students[i]->name);
        printf("GPA: %.2fn", students[i]->gpa);
    }

    // Free the allocated memory
    for (int i = 0; i < n; i++) {
        free(students[i]);
    }

    return 0;
}
📤 Output:
Input: 2
Input: 123
Input: Alice Smith
Input: 3.85
Input: 456
Input: Bob Johnson
Input: 3.5

Output:
Enter the number of students: Enter details for student 1:
ID: Name: GPA: Enter details for student 2:
ID: Name: GPA:
Student Details:
Student 1:
ID: 123
Name: Alice Smith
GPA: 3.85
Student 2:
ID: 456
Name: Bob Johnson
GPA: 3.50

💻 Pointer to Structure
#include <stdio.h>
#include <stdlib.h>

struct Person {
    char name[50];
    int age;
};

int main() {
    struct Person person1;
    struct Person *ptrPerson;

    ptrPerson = &person1;

    printf("Enter name: ");
    scanf("%s", ptrPerson->name);

    printf("Enter age: ");
    scanf("%d", &ptrPerson->age);

    printf("Name: %sn", ptrPerson->name);
    printf("Age: %dn", ptrPerson->age);

    return 0;
}
📤 Output:
Input: John
Input: 30
Output: Enter name: Enter age: Name: John
Age: 30

💻 Memory Freeing (free)
#include <stdio.h>
#include <stdlib.h>

int main() {
    int *ptr;

    ptr = (int *)malloc(sizeof(int));

    if (ptr == NULL) {
        printf("Memory allocation failed!n");
        return 1;
    }

    printf("Enter an integer value: ");
    scanf("%d", ptr);

    printf("You entered: %dn", *ptr);

    free(ptr);

    ptr = NULL;

    return 0;
}
📤 Output:
Input: 10
Output: Enter an integer value: You entered: 10

💻 Dynamic Memory Reallocation (realloc)
#include <stdio.h>
#include <stdlib.h>

int main() {
    int *arr;
    int size, new_size, i;

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

    arr = (int *)malloc(size * sizeof(int));

    if (arr == NULL) {
        printf("Memory allocation failed.n");
        return 1;
    }

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

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

    arr = (int *)realloc(arr, new_size * sizeof(int));

    if (arr == NULL) {
        printf("Memory reallocation failed.n");
        return 1;
    }

    printf("Memory reallocated successfully.n");

    if (new_size > size) {
        printf("Enter the remaining %d elements:n", new_size - size);
        for (i = size; i < new_size; i++) {
            scanf("%d", &arr[i]);
        }
    }

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

    free(arr);

    return 0;
}
📤 Output:
Input: 3
Output: Enter the initial size of the array:
Input: 1
Output: Enter 3 elements:
Input: 2
Output:
Input: 3
Output: Enter the new size of the array:
Input: 5
Output: Memory reallocated successfully.
Output: Enter the remaining 2 elements:
Input: 4
Output:
Input: 5
Output: Elements of the array:
Output: 1 2 3 4 5