Create and use nested for loops - C Statement

C examples for Statement:for

Introduction

A nested loop is one loop inside another loop.

Demo Code


#include <stdio.h>
#define ROWS  6//  ww  w  .  j ava 2  s .  c om
#define CHARS 10

int main(void){
    int row;
    char ch;
    
    for (row = 0; row < ROWS; row++)              
    {
        for (ch = 'A'; ch < ('A' + CHARS); ch++)  
            printf("%c", ch);
        printf("\n");
    }
    
    return 0;
}

Result


Related Tutorials