Skip to content

A beginner-friendly C program that generates even or odd numbers between a given range. It smartly adjusts the starting number if needed and uses switch-case to handle user choices efficiently.

Notifications You must be signed in to change notification settings

shohibulislam/even-and-odd-number-generator-C-Program

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Even & Odd Number Generator (Smart Range - C Program)

This simple C program allows users to generate all even or odd numbers within a specified range. It automatically adjusts the start number if it's not evenly divisible by 2, based on the user's choice. Useful for beginners learning loops and conditionals in C.

How It Works

  1. User selects:

    • 1 for Even numbers
    • 2 for Odd numbers
  2. User provides the start and end of the range.

  3. Program:

    • Adjusts the start value if needed.
    • Loops through the range with a step of 2 to print even or odd numbers.

Sample Output

Type
1 for even numbers
2 for an odd number
: 2
Where to start and end?
Type Start and End Number: 4 15
Odd numbers from 5 to 15 are:
5
7
9
11
13
15

Files

  • evenodd.c — Complete program source code

Requirements

  • C compiler (like gcc)
  • Works with Code::Blocks, VS Code, Dev C++, or any terminal

Features

  • Smart auto-adjustment of start number
  • Clean and user-friendly I/O
  • Uses switch-case for user choices

About

A beginner-friendly C program that generates even or odd numbers between a given range. It smartly adjusts the starting number if needed and uses switch-case to handle user choices efficiently.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages