Blog / Linux Examples March 18, 2015

A to Z Program

This program uses loop to display character from A to Z.

1- type into the shell

[cpp]
vi atoz.c
[/cpp]

copy the text below

[cpp]#include <stdio.h>
int main()
{
char c;
for(c=’A’; c&lt;=’Z’; ++c)
printf("%c ",c);
return 0;
}[/cpp]

 

press ESC one time, then :wq

2- type

[cpp]
gcc -o atoz1 atoz.c
[/cpp]

3- run the c program

[cpp]
./atoz1
[/cpp]

 

You may also like...