Use nested loops to produce a pattern based on letter - C Statement

C examples for Statement:for

Description

Use nested loops to produce a pattern based on letter

F
FE
FED
FEDC
FEDCB
FEDCBA

Demo Code


#include <stdio.h>

int main(void)
{
  for (int i = 1; i < 7; i++)
  {/*  ww w .ja va2s  .c om*/
    for (char c = 'F'; 'F' - c < i; c--)
    {
      printf("%c", c);
    }
    printf("\n");
  }

  return 0;
}

Result


Related Tutorials