Thursday 2 August 2012

Conditional statement022

Input the ASCII value and print its character value.


#include <stdio.h>
#include <conio.h>
void main ( )
{
        int       d;
        clrscr ( );
        
        printf ("\n Enter an ASCII value (0-255):"); scanf ("%d",&d);
        
        if ( d < 0 || d > 255 )
        {                    
                       printf("\n Invalid input.");
        }                              
        else                            
        {                                          
                       printf("\n Character value of %d is '%c'.",d,d);
        }
        getch ( );
}


Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...