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

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

Choosing Your First Programming Language: A Simple Guide

Embarking on your programming journey can be both exciting and overwhelming, especially when faced with the multitude of programming languages available. Selecting the right language for your first steps is crucial to setting a solid foundation. Here's a simple guide to help you navigate this decision-making process . 1.Define Your Goals and Interests Before diving into the array of programming languages, consider your goals and interests. Are you interested in web development, data science, game development, or something else? Different languages are tailored to specific domains, so aligning your choice with your aspirations is key. 2. Ease of Learning For beginners, languages with clear syntax and simple concepts can make the learning curve more manageable. Python, for instance, is known for its readability and simplicity, making it a popular choice for those new to programming. 3. Versatility Opting for a versatile language can broaden your opportunities. Python, JavaScript, and

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