Question #6059   Submitted by Answiki on 04/04/2022 at 09:33:34 PM UTC

How to write the alphabet in C with a loop?

Answer   Submitted by Answiki on 04/04/2022 at 09:36:02 PM UTC

The following codes display the 26 letters of the alphabet in C:

char c;

// Displays abcdefghijklmnopqrstuvwxyz
for (c='a'; c<='z' ; c++) printf ("%c", c);
  
// Displays ABCDEFGHIJKLMNOPQRSTUVWXYZ
for (c='A'; c<='Z' ; c++) printf ("%c", c);

Check this online example on repl.it.

3 events in history
Answer by Answiki on 04/04/2022 at 09:36:02 PM

The following codes display the 26 letters of the alphabet in C:

char c;

// Displays abcdefghijklmnopqrstuvwxyz
for (c='a'; c<='z' ; c++) printf ("%c", c);
  
// Displays ABCDEFGHIJKLMNOPQRSTUVWXYZ
for (c='A'; c<='Z' ; c++) printf ("%c", c);

Check this online example on repl.it.

Answer by Answiki on 04/04/2022 at 09:34:45 PM

The following codes display the 26 letters of the alphabet in C:

char c;

// Displays abcdefghijklmnopqrstuvwxyz
for (c='a'; c<='z' ; c++) printf ("%c", c);
  
// Displays ABCDEFGHIJKLMNOPQRSTUVWXYZ
for (c='A'; c<='Z' ; c++) printf ("%c", c);

Check this example online on repl.it.

Question by Answiki 04/04/2022 at 09:33:34 PM
How to write the alphabet in C with a loop?
# ID Query URL Count

Icons proudly provided by Friconix.