💻 #Program3 – Prime Number Checker & Range Finder Today’s coding challenge focuses on mathematical logic and optimization 🧮 I built a C program that lets users: 1️⃣ Check if a number is prime or not 2️⃣ Print all prime numbers within a given range The program uses modular arithmetic and checks divisibility only up to the square root of each number — a neat optimization that improves performance ⚡ It also handles invalid inputs (like reversed ranges) and counts how many primes were found. 🧠 Concepts practiced: Conditional statements (switch, if-else) Loops and function calls Boolean logic (true/false) Efficient use of sqrt() for prime testing Each challenge strengthens logic and problem-solving — one program at a time 💪 #100DaysOfCode #CProgramming #LearningByDoing #CodingChallenge #ProgrammersJourney #ProblemSolving #CodeNewbie
Prime Number Checker and Range Finder in C
More Relevant Posts
-
🧩 Day 64 of #100DaysOfCode 🧩 🔹 Problem: Remove All Adjacent Duplicates in String – LeetCode ✨ Approach: Used a stack-based approach to efficiently remove adjacent duplicates. For each character, if it matches the stack’s top element, pop it — otherwise, push it. A simple yet powerful way to process strings in O(n) time while maintaining clean logic. ⚡ 📊 Complexity Analysis: Time Complexity: O(n) — each character is processed once Space Complexity: O(n) — for the stack and output string ✅ Runtime: 23 ms (Beats 54.52%) ✅ Memory: 45.26 MB (Beats 85.43%) 🔑 Key Insight: Sometimes, solving problems isn’t about brute force — it’s about using the right data structure to make every step count. 💡 #LeetCode #100DaysOfCode #ProblemSolving #DSA #Stack #StringManipulation #CleanCode #CodingChallenge #AlgorithmDesign #LogicBuilding #CodeJourney #Programming
To view or add a comment, sign in
-
-
🚀 Algorithm Challenge #18 🧠 Problem Title: Calculate the Area of a Circle using its Radius ✅ Language Used: C++ 💡 What it covers: Using constants (const) in C++ Applying mathematical formulas (π * r²) Working with the <cmath> library Strengthening understanding of geometry-based logic 📂 GitHub Repo: 🔗 https://lnkd.in/dw7hMReZ 📝 Short Description: In this challenge, I wrote a C++ program that calculates the area of a circle from its radius using the formula π × r². This task focuses on how to apply mathematical equations in C++, and highlights the importance of using constants and clean syntax. 💬 Feedback Welcome! I’d love to hear your feedback or see your version of the same challenge — let’s keep improving together. 🔁 Stay tuned for Challenge #19 coming soon! #Cpp #Programming #Algorithms #CodingChallenge #MathInCode #ProblemSolving #LearnToCode #Geometry #SoftwareDevelopment #BuildInPublic #TechLearning #CppProgramming #CodeNewbie #STEM #CircleArea
To view or add a comment, sign in
-
🚀 Today I practiced one of the most important Linked List problems — Sorting a Linked List efficiently. Instead of converting the list into an array (which increases extra memory usage), I implemented Merge Sort directly on the linked list. 🔍 Why Merge Sort for Linked List? Linked lists don’t have random indexing. Merge Sort works naturally by rearranging pointers. No need of extra space for arrays. 🎯 Result: Time Complexity: O(n log n) Space Complexity: O(log n) due to recursion Stable & Clean Solution 💡 What I learned: Using slow–fast pointer technique to find the middle of the list. Splitting the linked list into two halves efficiently. Merging two sorted linked lists without extra memory. Writing cleaner, structured logic improves readability a LOT. Everyday small progress really compounds. Trying to solve at least one challenge daily 💪 #ConsistencyWins #leetcode #dsa #linkedlist #algorithms #programming #cpp #softwareengineering #codingjourney #learningeveryday #100daysofcode
To view or add a comment, sign in
-
-
Today I built something simple but powerful — a Number Converter in C that can convert values across different number systems: ✅ Binary → Decimal ✅ Binary → Octal ✅ Octal → Binary ✅ Octal → Decimal ✅ Decimal → Binary ✅ Decimal → Octal It might sound basic, but implementing this logic without any built-in math library really helped me strengthen my understanding of number systems, loops, and base conversions. While working on it, I made sure every step (from binary to decimal calculation to octal conversion) followed manual bitwise-style logic using just loops and base multipliers — no shortcuts. #CProgramming #Developer #LearningByBuilding #SoftwareEngineer #DSA #LogicBuilding #CodingJourney
To view or add a comment, sign in
-
Day Two: Diving Deeper into C – The Power of Precision and Pointers 🚀 Day 2 of my deep dive into C programming was incredibly productive, spanning three critical areas that enhance control and precision in low-level development. Boolean Logic: Successfully implemented bool functions to handle clear, concise True/False logic. This is key for creating highly readable and efficient decision-making structures within programs. String Manipulation: Explored the mechanics of using multiple arrays of characters (the C way of handling strings). Understanding how to organize and access collections of character data is fundamental for text processing. Pointers Unlocked: Built directly on Day 1's foundation by learning the practical application of Pointers. This exercise truly demonstrated how storing and manipulating the address of a variable allows for powerful, dynamic control over memory. Connecting these concepts reveals the true power of C: the ability to manage data types, logic, and memory with absolute precision. 💡 Next Goal: I'm already working on it 🚀! #CProgramming #Pointers #DataStructures #LowLevelProgramming #LearningInPublic #Day2 #ImanLearns
To view or add a comment, sign in
-
-
🚀 Tried breaking down Pascal’s Triangle in the simplest way 👇 We’ve all seen this pattern(Pascal's Triangle) somewhere but have you ever wondered how it’s actually generated? 🤔 The question is simple: 👉 Given an integer n, generate the first n rows of Pascal’s Triangle. For example, when n = 3 💡 How this approach clicked: While thinking about how each element is formed, I realized that every value in Pascal’s Triangle is just a combination (nCr) and this relation C(n,r)=C(n,r−1)∗(n−r+1)/r , is connecting each next element with the previous one computed. This not only makes the logic cleaner but also eliminates redundant factorial computations. so, here is the code and the dry run of the solution , once you see it this way, Pascal’s Triangle feels surprisingly simple! 😄 #C++ #DSA #ProblemSolving #CodingJourney #PascalTriangle #Programming #Learn #CodeVisualization #WomenInTech
To view or add a comment, sign in
-
-
Day 81/365 : Go basics Q1: How do you convert an integer to a string in Go? - Use the strconv package import ( "strconv" ) func main() { i := 123 s := strconv.Itoa(i) fmt.Println(s) // "123" } Q2: Can you explain how named return values work in Go? -> Named return values allow you to predefine the return variables in the function signature, simplifying the return statements. func divide(a, b float64) (result float64, err error) { if b == 0 { err = errors.New("division by zero") return } result = a / b return } Q3: How do you use anonymous functions in Go? -- function without a name, often defined inline. func main() { add := func(a, b int) int { return a + b } fmt.Println(add(2, 3)) // Outputs 5 } #GoLang #LearningToCode #Programming #CodingJourney #TechCommunity #GoDevelopers
To view or add a comment, sign in
-
🧠 Day 37 of #100DaysOfCode 📦 Project: Number to Words Converter in C Today I built a C program that converts any number (up to 9 digits) into its word representation! 💬🔢 ✨ Highlights: Handles billions, millions, thousands, and hundreds with proper segmentation. Covers special cases like teens (10–19) and tens (20, 30, …). Modular design using arrays for digit names and a clean convert_hundreds() function. Input: 123456789 → Output: "One Hundred Twenty Three Million Four Hundred Fifty Six Thousand Seven Hundred Eighty Nine" This was a fun challenge in logic structuring and string formatting. It deepened my understanding of number decomposition and control flow in C. 💡 Next up: maybe adding support for decimals or currency formatting? 💸 🔧 Built with: C language Console I/O Arrays & conditionals #CProgramming #CodingChallenge #100DaysOfCode #CodeNewbie
To view or add a comment, sign in
-
🚀 Day 17 of #100DaysofCode Challenge! 🚀 🔍 What is Dynamic Programming (DP), and why does it matter? I recently watched Aditya Verma’s introductory video on DP and here are the highlights: • DP is an optimization over naïve recursion — it’s about identifying when you’re solving the same sub-problem repeatedly, and instead reuse those results (overlapping sub-problems + optimal substructure). • The typical workflow: start with a recursive solution, notice repeated work → switch to memoization (top-down) → then possibly convert to tabulation (bottom-up). • The key mindset shift: Think in terms of subproblem states and transitions/choices — that’s what lets you build from smaller results to the full solution. • Use DP when brute force recursion is too slow and when the problem naturally splits into smaller pieces whose optimal solutions combine. • Base cases, initialization, and correct ordering (especially in bottom-up) are crucial — you can’t just “DP-ify” any recursion without thinking about these. #Day17 #DynamicProgramming #Algorithms #ProblemSolving #CodingMindset #SoftwareEngineering #AdityaVerma #CodingJourney
To view or add a comment, sign in
-
-
Hot take: Using stochastic LLMs to write imperative, step-by-step code is like using a probability engine to calculate 2+2. Sure, it works... but are we applying the wrong tool to the problem, or are we still thinking about programming in outdated paradigms?
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development