Skip to content

samidukushalaya/Beginner_Neural_network_in_C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 Simple Neural Network in C (AND & OR Gates)

This project demonstrates a basic single-layer neural network (perceptron) implemented in C, trained to learn the behavior of logic gates: AND and OR.

It's designed as a learning tool for beginners who want to understand the fundamentals of neural networks without using any external libraries.


πŸš€ Features

  • Learn AND or OR gate using the same code
  • Implements:
    • Forward propagation
    • Sigmoid activation function
    • Backpropagation with gradient descent
  • Clean, commented C code for easy understanding

πŸ§ͺ Logic Gates Overview

βœ… AND Gate

Input A Input B Output
0 0 0
0 1 0
1 0 0
1 1 1

βœ… OR Gate

Input A Input B Output
0 0 0
0 1 1
1 0 1
1 1 1
  • The more you train, the more accurate the output becomes.

    πŸ“‘ To train the model more to get accurate output,
    • For OR Gate Change the test number in line 28
    • For AND Gate Change the epochs number in line 28

πŸ› οΈ Getting Started

πŸ”§ Prerequisites

  • Code editor (vscode , codeblock)
  • C Compiler (e.g. gcc)

About

🧠 This project demonstrates a basic single-layer neural network (perceptron) implemented in C, trained to learn the behavior of logic gates: AND and OR.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages