How to use reverse while loop in C Language

While Loop

On this page

While Loop

Program to use Reverse While Loop in C Language

#include 
int main()
{
  int k = 10;
  while (k >= 2)
  {
      printf("%d\t", k);
      k = k - 2;
  }
  return 0;
}

Output

10  8  6  4  2

Steps Description

  • Declare integer variable k = 10
  • Initialize in integer variable k = 10
  • While condition code =2> code is to evulument the value of (i)