While loop to print char : While « Language Basics « C / ANSI-C






While loop to print char


#include <stdio.h>

int main() {
  char ch;

  ch = 'a';

  while ( ch <= 'z' ) 
      printf ( "%c", ch++ );
  
  printf ( "\n" );
}


           
       








Related examples in the same category

1.While to sum integers
2.a while loop nested in for loopa while loop nested in for loop
3.Use getchar inside while loop