# C++(while and for loops)

while-loop in Python

```python
elapsed_time = 15

while(elapsed_time > 0):
    print('Traffic light is still red')
    elapsed_time = elapsed_time - 1

print('Traffic_light is already green')
```

C++

```cpp
#include<iostream>

int main(){
    int elapsed_time = 15;
    
    while (elapsed_time > 0) {
        std::cout << 'Traffic light is still red' << '\n';
        elapsed_time = elapsed_time - 1;
    }
    
    std::cout << "Traffic light is already green" << '\n';
    
    return 0;
}
```

for-loop in Python:

```python
elapsed_time = 15

for i in range(0, elapsed_time):
    print('Traffic light is still red')

print('Traffic light is already green')
```

C++

```cpp
#include<iostream>

int main() {
    int elapsed_time = 15;
    
    for (int i = 0; i < elapsed_time; i++) {
    std::cout << "Traffic light is still red" << std::endl;
    }
    
    std::cout << "Traffic light is already green" << std::endl;
    
    return 0;
}
```
