🧠 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
More Relevant Posts
-
🚀 Create Two-Dimensional Arrays in Modern C++ Using Alias Templates In modern C++, we prefer using std::array over raw C-style arrays. Creating a one-dimensional array is clean and straightforward: std::array arr { 1, 2, 3, 4, 5 }; // CTAD (C++17) But things get verbose when creating a two-dimensional array: std::array<std::array<int, 4>, 3> arr {{ { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 } }}; 👉 Notice the double braces. This happens because std::array is essentially a struct containing a single C-style array member, so we need an extra level of braces to initialize it. The syntax is correct — but it's not elegant. It’s verbose, easy to misread, and the template arguments (Col, Row) are reversed from how we naturally think about matrices. 💡 Alias templates to the rescue. We can simplify the syntax using an alias template: template <typename T, std::size_t Row, std::size_t Col> using Array2d = std::array<std::array<T, Col>, Row>; Now creating a 2D array becomes clean and intuitive: Array2d<int, 3, 4> arr {{ { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 } }}; ✔️ More concise ✔️ Less error-prone ✔️ Easier to read and maintain Alias templates are a powerful part of modern C++, and small improvements like this can significantly clean up code in real projects. 📘 Reference: LearnCpp.com — Multidimensional std::array
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
-
-
💻 #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
To view or add a comment, sign in
-
-
#NationSkill Day 99| Problem Solving Challenge Today’s task: Get Minimum Squares Platform: #GeeksforGeeks | Concepts Used: Dynamic Programming (DP) Problem: Find the minimum number of perfect squares that sum up to a given integer n. Approach: Bottom-Up DP — calculating the minimum count for each value up to n by checking all perfect squares less than it. Example: Input: 6 → Output: 3 Explanation → 1*1 + 1*1 + 2*2 = 6 Time Complexity: O(n * √n)
To view or add a comment, sign in
-
-
Why does JavaScript think 0.1 + 0.2 = 0.30000000000000004? 🤯 Just wrote a deep dive into the weird world of floating-point arithmetic that every developer needs to understand. From the Patriot Missile bug that cost lives to why your shopping cart might be losing pennies, this explores why computers are surprisingly bad at "simple" math—and what you can do about it. Whether you're a junior dev confused by your first floating-point bug or a senior who wants to understand the actual bits involved, this breaks down the IEEE 754 standard in a way that's both technically accurate and actually enjoyable to read. Because sometimes the computer isn't wrong—it's just counting differently than we are. 💻 #JavaScript #Programming #SoftwareEngineering #WebDevelopment #CodingTips #TechEducation #IEEE754 #FloatingPoint Link: ---> https://lnkd.in/gtrZTzu7
To view or add a comment, sign in
-
🚀 Day 56 of #100DaysOfCode 🎯 Problem: Rotate Image ✨ Approach: Rotating a matrix by 90° clockwise involves transposing and then reversing, but here I implemented it using an auxiliary matrix for clarity and precision. Each element’s new position is determined by transforming its coordinates — a great test of matrix manipulation logic! 🧩 ⚙️ Complexity Analysis: Time Complexity: O(n²) — every element is visited once Space Complexity: O(n²) — used an additional matrix for transformation 📊 Result: ✅ Runtime: 0 ms (Beats 💯%) ✅ Memory: 41.8 MB (Beats 99.32%) 💡 Key Insight: Matrix rotation is more than a pattern — it’s spatial reasoning in action! Perfect for mastering 2D array manipulation and index mapping 🔄 #100DaysOfCode #LeetCode #Java #MatrixRotation #ProblemSolving #CodingChallenge #DSA #Programming #LogicBuilding #CleanCode #DeveloperJourney #CodeEveryday
To view or add a comment, sign in
-
-
💡 𝐋𝐞𝐞𝐭𝐂𝐨𝐝𝐞 𝐃𝐚𝐢𝐥𝐲 𝐂𝐡𝐚𝐥𝐥𝐞𝐧𝐠𝐞 -𝟒𝟕𝟒. 𝐎𝐧𝐞𝐬 𝐚𝐧𝐝 𝐙𝐞𝐫𝐨𝐞𝐬 We’re given a list of binary strings and two integers m and n. The task is to find the largest subset of strings such that the total number of 0s ≤ m and 1s ≤ n. 🧩 My Approach: I solved it using Top-Down DP (Memoization) : • For each string, I had two choices - include it (if within limits) or skip it. • Used a 3D memo[i][m][n] to store results for subproblems (index i, remaining 0s, remaining 1s). • Compared both choices and took the maximum. • This way, we efficiently explore all possibilities while avoiding redundant recalculations. Learning: Dynamic programming shines when you break problems into overlapping subproblems and optimize with memoization. #LeetCode #DSA #DynamicProgramming #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
From the Plant to the Keyboard This is one of my first projects in C++, and I wanted to start with something I actually use every day figuring out chemical feed rates in mL per minute. I’ve done this math by hand plenty of times in the field, but this time I wanted to see what it looked like written out in code. It’s not fancy, but it’s mine a mix of my water treatment experience and my growing understanding of programming. Each small project like this feels like connecting two worlds I care about: process control and code. If you’re curious, you can check it out here . https://lnkd.in/grk6KDFN
To view or add a comment, sign in
-
#Day12 Effective Handling of Multi Dimensional Lists in TCL Shell Hello all. Tcl treats everything as a string, but the list data structure is a standard sequence of elements where each element is separated by whitespace. Tcl commands like $lappend, $linsert, and $lindex are specifically designed to treat these strings as structured lists, handling nested lists correctly. When lists are enclosed in curly braces ({}), Tcl ensures that the elements within are treated as a single element of the parent list, preventing them from being split by whitespace during operations. For instance, when $sub\_list1 is appended to $main\_list, the three words within $sub\_list1$ are added as a single, multi-word element. Today I have designed the list manipulation using adding the list. The coding and the output is provided in the PDF. #Tcl #Programming #CodingChallenge #List #Manipulation #adding #A #List #SoftwareDevelopment #LearnToCode #20DayTclChallenge #TclTk #Day12of20
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
Your consistency is next level! 🚀 Would love to connect and learn more. Anmol Singh