Wednesday 8 August 2012

Loop control structure015


Write a program to print all the ASCII values and there equivalent charecters using a while loop. The ASCII values vary from 0 to 255.

#include <stdio.h>
#include <conio.h>

void main ( )
{
        int           co = 0;
        clrscr ( );
                         
        while ( co <= 255 )
        {                       
                        printf ("\n\t %3d -----> %c \n", co, co);
                        if ( co != 0 )
                        {                    
                                   if ( co % 21 == 0)
                                   {                         
                                                     printf ("\n\t Press any key to continue");
                                                     getch ( );
                                                     clrscr ( );
                                   }
                        }
                        co ++;
        }
        getch ( );
}

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...