Skip to main content

Small Projects For Beginners - C Language

 In here I will show you some small projects for beginners.


1. Calculator

2. To-Do List

3. Guess the Number Game

4. Bank Management System

5. Student Grade Calculator

6. Simple File Encryption/Decryption

7. Library Management System

8. Temperature Converter


These projects I have done with dev C++ .

A) Create a Calculator

  • Create a basic calculator program that can perform arithmetic operations like addition, subtraction, multiplication, and division.
  • Allow the user to input two numbers and choose the operation.
  • Display the result.

       

       


#include <stdio.h>
int main() {
    int num1, num2;
    char operator;

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

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

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

    switch (operator) {
        case '+':
            printf("Result: %d\n", num1 + num2);
            break;
        case '-':
            printf("Result: %d\n", num1 - num2);
            break;
        case '*':
            printf("Result: %d\n", num1 * num2);
            break;
        case '/':
            if (num2 != 0) {
                printf("Result: %.2f\n", (float)num1 / num2);
            } else {
                printf("Error: Division by zero.\n");
            }
            break;
        default:
            printf("Error: Invalid operator.\n");
    }

    return 0;
}

b) Create a Temperature Converter

  • Develop a program that converts temperatures between Fahrenheit and Celsius.
  • Allow users to input a temperature and choose the conversion direction.
  • Display the converted temperature.




#include <stdio.h>

int main() {
    // Declare variables
    float temperature;
    char choice;

    // Display menu and get user choice
    printf("Temperature Converter\n");
    printf("1. Fahrenheit to Celsius\n");
    printf("2. Celsius to Fahrenheit\n");
    printf("Enter your choice (1 or 2): ");
    scanf(" %c", &choice);

    // Get temperature from user
    printf("Enter temperature: ");
    scanf("%f", &temperature);

    // Perform temperature conversion based on user choice
    switch (choice) {
        case '1':
            // Fahrenheit to Celsius conversion
            temperature = (temperature - 32) * 5 / 9;
            printf("Temperature in Celsius: %.2f\n", temperature);
            break;
        case '2':
            // Celsius to Fahrenheit conversion
            temperature = (temperature * 9 / 5) + 32;
            printf("Temperature in Fahrenheit: %.2f\n", temperature);
            break;
        default:
            // Invalid choice
            printf("Invalid choice. Please enter 1 or 2.\n");
    }

    return 0;
}




Comments

Popular posts from this blog

Achieving Success : Simple stragedies for the journey

 U nlocking the path to success  Success is a journey not a destination. 1.Define your vision "Where there is no vision, there is no hope" - George Washington Carver 2.Set smart goals "Setting goals is the first step in turning the invisible into the visible "   -    Tony Robbins 3.Embrace continuous learning "Continuous learning is the minimum requirement for success in any field" - Brian Tracy 4.Cultivate a growth mindset A growth mindset sees challenges as opportunities for growth  5.Develop strong work ethics "The best way to learn is by doing. The only wat to build a strong work ethic is getting your hands dirty" - Alex Spanos 6.Build a supportive network "Networking is an essential part of building wealth" - Armstrong Williams 7.Embrace  resilience "Resilience is knowing that you are the only one who has the power and the responsibility to pick yourself up." - Mary Holloway 8.Practice mindfulness "Mindfulness mea...

Artificial Intelligence (AI): Transforming the Landscape of Innovation

Artificial Intelligence (AI): " Transforming the Landscape of Innovation". In the unexpectedly evolving world of generation, Artificial Intelligence (AI) stands as a beacon of transformative power. From revolutionizing industries to reshaping every day life, AI is at the leading edge of innovation. This article delves into the important thing sides of AI, exploring its contemporary nation, ability applications, moral issues, and the consequences for the future. Understanding AI: At its middle, AI refers back to the improvement of computer structures which can perform duties that normally require human intelligence. This contains a extensive variety of capabilities, from hassle-solving and studying to herbal language processing and belief. Machine Learning (ML), a subset of AI, permits structures to enhance overall performance primarily based on enjoy, similarly amplifying their adaptability. Current Applications: AI has already woven itself into the material of diverse...

Hey, Let Me Tell You About This Awesome Day I Had!

You know those days where everything just clicks, and you're like, "Wow, life is pretty amazing"? Well, I recently had one of those days, and I've gotta spill the beans about it! So, picture this: I woke up feeling all refreshed and ready to tackle the world. The sun was peeking through my curtains, and I could already tell it was gonna be a good one. No Monday blues in sight! I decided to kick things off with a little nature therapy, so I headed to this nearby park. Let me tell you, it was like stepping into a scene from a fairytale. The birds were singing, the trees were swaying, and I just strolled around, soaking it all in. It was the perfect start to the day – peaceful and rejuvenating. After my park adventure, I found myself drawn to this adorable cafĂ© I'd been meaning to check out. I swear, it was straight out of a Pinterest board. The vibe was cozy, the coffee was top-notch, and I had the place practically to myself. I grabbed a seat by the window, cracked...