Skip to content

This is a simple C program that checks whether a given number is a prime number or not. It accepts a number from the user and prints a clear message about its status.

License

Notifications You must be signed in to change notification settings

silven-mohan/Prime_Number_Detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prime_Number_Detector

CI


This is a simple C program that checks whether a given number is a prime number or not. It accepts a number from the user and prints a clear message about its status.


🛠 Features

  • ✔ Checks if the input number is a prime
  • ❗ Handles edge case: 1 is neither prime nor composite
  • 📘 Uses basic loops and conditionals only
  • 🖥 Beginner-friendly, no external libraries required

📦 How It Works

  1. Takes an integer input n
  2. If n == 1, prints it's neither prime nor composite
  3. Otherwise, checks divisibility from 2 to n-1
  4. If no divisor is found → prime, else → not prime

💻 Sample Output

Enter any number: 13
13 is a prime number

Enter any number: 9
9 is not a prime number

Enter any number: 1
1 is neither a prime nor a composite number.

📃License

See included LICENSE file for more details.


Author-Silven Mohan

About

This is a simple C program that checks whether a given number is a prime number or not. It accepts a number from the user and prints a clear message about its status.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages