BMR AI
By using this service you agree to read and accept our Terms and conditions and Privacy Policy
Chat Now
GUIDE

Welcome to our BMR AI CHATBOT.

A free expermental AI tool where you can interact with the webpage, ask question about the webpage and other related doubts.

In some cases reponses may take time to get. In case of error give us your report.

You responses are stored for experimental purpuses. And your personal info is not integrated with you in any way.

Note: AI can make mistakes and can give in appropiate responses. Your feedbak will help us improve.

Stay tuned for more AI products and tools

And Finally don't forget to give your feedback. click on the icon provided to give feedback.

REPORT ERROR

SUBMIT
DELETE CHAT

C For Loop

Used to iterate a specific number of times.

Syntax:
for (initialization; condition; update) {
// Code to be executed in each iteration
}

  1. Initialization - It initializes the variable for the loop to process.
  2. Condition - Checks the condition before iteration. If false it exits the loop.
  3. Update - It increments or decrements the variable used to initilize the loop.

Example

#include <stdio.h>

int main() {
    // Print numbers from 1 to 5 using a for loop
    for (int i = 1; i <= 5; i++) {
        printf("%d ", i);
    }

    return 0;
}

See how the loop works

  1. int i = 1 initializes the variable i to 1.
  2. i <= 5 is the condition that checks if i <= 5.
  3. i++ increments the value of i after each iteration

Using Arrays

Example

#include <stdio.h>

int main() {
    // Iterating through an array
    int numbers[] = {10, 20, 30, 40, 50};
    
    for (int i = 0; i < 5; i++) {
        printf("%d ", numbers[i]);
    }

    return 0;
}

Learn more about C arrays


Quick Recap - Topics Covered

C For Loop

Practice With Examples in Compilers

The Concepts and codes you leart practice in Compilers till you are confident of doing on your own. A Various methods of examples, concepts, codes availble in our websites. Don't know where to start Down some code examples are given for this page topic use the code and compiler.

Example JS

Example 1 Example 2 Example 3 Example 4 Example 5

Quiz


FOLLOW FOR MORE UPDATES

Official Facebook Account Official Instagram Account Offcial X (formerly known as Twitter) Account Offficial Youtube Channel
BMR EDUCATION © 2024 All rights reserved