# 4.1.1 Loop (Repetition)

## ৪.‌‌‌১.১ লুপ (পুনরাবৃত্তি) (১)

1. \[1] "Hello World" লেখাটি N সংখ্যাক বার প্রিন্ট কর। (মনেকর N যে কোন একটি পূর্ণসংখ্যা)

## সমাধান

### \[1] "Hello World" লেখাটি N সংখ্যাক বার প্রিন্ট কর। (মনেকর N যে কোন একটি পূর্ণসংখ্যা)

{% tabs %}
{% tab title="for 1 to 5" %}
{% code lineNumbers="true" %}
```c
#include<stdio.h>
int main(){
    int n, i;
    
    n = 5;
    for(i = 1; i <= n; i++){
        printf("Hello World\n");
    }

    return 0;
}
```
{% endcode %}

**Sample Input Output:**

<table><thead><tr><th>Input</th><th>Output</th></tr></thead><tbody><tr><td></td><td><pre><code>Hello World
Hello World
Hello World
Hello World
Hello World
</code></pre></td></tr></tbody></table>
{% endtab %}

{% tab title="for 0 untill 5" %}


{% code lineNumbers="true" %}
```c
#include<stdio.h>
int main(){
    int n, i;
    
    n = 5;
    for(i = 0; i < n; i++){
        printf("Hello World\n");
    }

    return 0;
}
```
{% endcode %}

**Sample Input Output:**

<table><thead><tr><th>Input</th><th>Output</th></tr></thead><tbody><tr><td></td><td><pre><code>Hello World
Hello World
Hello World
Hello World
Hello World
</code></pre></td></tr></tbody></table>
{% endtab %}

{% tab title="for user input" %}


{% code lineNumbers="true" %}
```c
#include<stdio.h>
int main(){
    int n, i;
    
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        printf("Hello World\n");
    }

    return 0;
}
```
{% endcode %}

**Sample Input Output:**

<table><thead><tr><th>Input</th><th>Output</th></tr></thead><tbody><tr><td>5</td><td><pre><code>Hello World
Hello World
Hello World
Hello World
Hello World
</code></pre></td></tr><tr><td>3</td><td><pre><code>Hello World
Hello World
Hello World
</code></pre></td></tr></tbody></table>
{% endtab %}

{% tab title="while" %}


{% code lineNumbers="true" %}
```c
#include<stdio.h>
int main(){
    int n, i;
    
    scanf("%d", &n);
    i = 0;
    while(i < n){
        printf("Hello World\n");
        i++;
    }

    return 0;
}
```
{% endcode %}

**Sample Input Output:**

<table><thead><tr><th>Input</th><th>Output</th></tr></thead><tbody><tr><td>5</td><td><pre><code>Hello World
Hello World
Hello World
Hello World
Hello World
</code></pre></td></tr><tr><td>3</td><td><pre><code>Hello World
Hello World
Hello World
</code></pre></td></tr></tbody></table>
{% endtab %}

{% tab title="do while" %}


{% code lineNumbers="true" %}
```c
#include<stdio.h>
int main(){
    int n, i;
    
    scanf("%d", &n);
    i = 0;
    do{
        printf("Hello World\n");
        i++;
    }while(i < n);

    return 0;
}
```
{% endcode %}

**Sample Input Output:**

<table><thead><tr><th>Input</th><th>Output</th></tr></thead><tbody><tr><td>5</td><td><pre><code>Hello World
Hello World
Hello World
Hello World
Hello World
</code></pre></td></tr><tr><td>3</td><td><pre><code>Hello World
Hello World
Hello World
</code></pre></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

