In this program, I used a while loop to print numbers from 1 to 5 and calculate their total sum at the same time. 🔁 It’s a great example of how loops can perform multiple tasks — displaying numbers and performing calculations in one go! 🚀 ✨ Concepts Used: ➡️ Variable initialization (c = 1, sum = 0) ➡️ While loop condition (c <= 5) ➡️ Increment operators (c = c + 1, sum = sum + 1) ➡️ Output using printf() This simple logic builds the foundation for more complex algorithms in programming! 💪 #CProgramming #WhileLoop #CodingPractice #LearnToCode #ProgrammingBasics #CodeJourney #ProblemSolving 💻
Iqra Owais’ Post
More Relevant Posts
-
n this program, I used a while loop to print numbers from 1 to 10 on the screen. 🎯 It’s a simple example but a great way to understand how loops work in C programming — they help us repeat actions automatically without writing the same line again and again! 🔁 ✨ Concepts Used: ➡️ Variable initialization (n = 1;) ➡️ Loop condition (n <= 10) ➡️ Increment operator (n++) ➡️ Output using printf() Every small program is a step toward writing bigger logic and better code! 🚀 #CProgramming #CodingPractice #WhileLoop #ProgrammingBasics #CodeJourney #LearningByDoing 💻
To view or add a comment, sign in
-
-
📅 Day 33 of #100DaysOfCode Problem: Basic Calculator (LeetCode 224) Approach: 1️⃣ Parsed the string character by character, keeping track of current number, sign, and result. 2️⃣ When encountering '+' or '-', added the previous number to the result and reset the current number. 3️⃣ Used a stack to handle parentheses — pushed the current result and sign when '(' was found, then restored them after ')'. 4️⃣ Carefully computed the final result by adding the last pending number after traversal. #100DaysOfCode #LeetCode #DSA #ProblemSolving #Stack #Cplusplus #CodingChallenge #Algorithms #Math #CodeNewbie #Programming #SoftwareEngineering #CodingJourney #TechCommunity #DeveloperLife #KeepLearning #LearningInPublic #Motivation
To view or add a comment, sign in
-
-
🚀 Day 68 | Dynamic Programming & Number Generation Today’s challenge extended the classic Ugly Number problem — focusing on efficiently generating the n-th Ugly Number using dynamic programming. 🧩 Problem Solved: 264. Ugly Number II • Approach: Used three pointers (for 2, 3, and 5) to iteratively build the sequence of ugly numbers in sorted order without duplicates. • Insight: Smart pointer movement and caching transform brute-force multiplication into an elegant O(n) solution. ✨ Key Takeaway: Efficiency is often about recognizing overlapping computations and reusing them — that’s the beauty of dynamic programming. 📚 Topics: Dynamic Programming · Heaps · Math 💻 Platform: LeetCode #DSA #LeetCode #ProblemSolving #DailyCoding #DynamicProgramming #Math #Consistency
To view or add a comment, sign in
-
-
Level Up Your Coding Skills: Understanding the Sliding Window Algorithm The Sliding Window Algorithm is one of the most essential techniques for tackling array, string, and list problems efficiently. If you're interviewing or just want to write better code, this is a must-know! Core concepts in the video: ➡️ Why it matters: Learn how this algorithm drastically reduces time complexity (often from O(N^2) to O(N)) by avoiding redundant calculations. ➡️ What is it: It's essentially a sub-array or sub-string that "slides" through a data structure. ➡️ How it slides: We explore the key mechanics of adding elements to the right and dropping them from the left. ➡️ Fixed vs. Dynamic Windows: Understand the difference between finding a maximum sum of a fixed size 'k' (Fixed) versus finding the longest sub-string with no repeating characters (Dynamic). #SlidingWindow #Algorithms #DataStructures #CodingInterview #ProblemSolving #Programming #SoftwareDevelopment #ComputerScience #CodingTips #LearnToCode
To view or add a comment, sign in
-
💡 Day 84 of My LeetCode Journey – Problem 1614: Maximum Nesting Depth of Parentheses Today’s problem tested my understanding of stack concepts and string traversal — determining how deeply parentheses are nested in a given string. 🧠 Concept: The idea is simple yet elegant: Traverse the string character by character. Use a counter to track the number of open parentheses (. Update the maximum depth whenever the count increases. Decrease the counter when a closing parenthesis ) appears. Example: "(1+(2*3)+((8)/4))+1" → Maximum depth = 3 ✅ Key Takeaways: Strengthened understanding of parentheses matching and depth counting. Improved ability to simulate stack behavior without extra space. Reinforced skills in clean logic implementation and iteration control. Small yet powerful problems like this sharpen clarity, precision, and logical thinking 🧩 #LeetCode #ProblemSolving #100DaysOfCode #DSA #CodingChallenge #Programming #LogicBuilding #Cplusplus #DailyCoding #LearningEveryday
To view or add a comment, sign in
-
-
From Arrays and Linked Lists to Graphs and Tries, each structure organizes data differently and serves unique real-world purposes — from managing browser history and social networks to building file systems and dictionaries. Whether you’re coding algorithms or optimizing applications, knowing when to use the right structure makes all the difference. Start small, visualize often, and build your foundation strong. 💡 #DataStructures #Programming #SoftwareEngineering #LearnToCode #TechEducation
To view or add a comment, sign in
-
-
🚀 Day 46 of #100DaysOfCode 📌 LeetCode 844 — Backspace String Compare Today I tackled a problem that looks simple but exposes whether you can simulate string editing efficiently. 🧠 My Intuition Instead of building and modifying strings directly (which is messy and inefficient), I treated the input like a real typing scenario: Use a stack to simulate typing. Push normal characters. Pop when a # appears (acting as backspace). Build the final strings for both inputs and compare them. This makes the whole process clean and avoids unnecessary edge-case headaches. 🔥 Takeaway: When dealing with “string editors,” stacks simplify life. You avoid messy manual string manipulation and let the stack handle the backtracking for you. #leetcode #dsa #javacoding #codingjourney #100daysofcode #leetcode844 #programming
To view or add a comment, sign in
-
-
🔥 Day 83 of My LeetCode Journey – Problem 242: Valid Anagram Today’s problem focused on one of the most classic string challenges — determining whether two strings are anagrams of each other. An anagram means both strings contain the same characters with the same frequency, just arranged differently. 💡 Concept: If two strings have identical character counts for every letter, they’re anagrams. Common approaches include: Using a frequency counter (hash map or array) Sorting both strings and comparing them directly ✅ Key Takeaways: Strengthened logic around hash maps and string frequency counting Learned efficient ways to compare large datasets of characters Reinforced time-space optimization techniques for string problems Small problems like this one help sharpen attention to detail and analytical accuracy, key skills for every programmer 🚀 #LeetCode #ProblemSolving #100DaysOfCode #DSA #Cplusplus #CodingChallenge #Anagram #Programming #LogicBuilding #LearningEveryday
To view or add a comment, sign in
-
-
Exploring the power of Dynamic Memory Allocation in C! This simple program uses malloc() and pointer arithmetic to allocate memory at runtime and display user inputs efficiently. Learning how memory works at a low level gives a strong foundation for writing optimized and scalable code. #CProgramming #DynamicMemoryAllocation #TechLearning #ProgrammingJourney #LinkedInCodingCommunity #DeveloperLife
To view or add a comment, sign in
-
-
LeetCode | Maximum Subarray - Solved using Kadane’s Algorithm (C++) Just solved the Maximum Subarray problem on LeetCode - one of the most classic dynamic programming problems that teaches the power of efficient subarray computations. Intuition: At every step, decide whether to extend the current subarray or start a new one based on which gives a larger sum. Approach: This is achieved using Kadane’s Algorithm, which runs in linear time - keeping track of the current maximum subarray sum and updating the global maximum as we iterate. Complexity: Time Complexity: O(n) Space Complexity: O(1)
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
wow great you can make a simple basic virus by manipulating this loop