1. C PROGRAM TO PRINT ASCII VALUES.
#include<stdio.h>
#include<conio.h>
void main()
{
char c;
clrscr();
printf("Enter a character:-");
//reads characters from user
scanf("%c",&c);
printf("ASCII value of character= %d", c);
//%d is displays the integer value of a character
getch();
}
2. C++ PROGRAM TO PRINT ASCII VALUES.
#include<iostream.h>
#include<conio.h>
void main()
{
char c;
clrscr();
cout<<"Enter a character:-";
cin>>c; //reads characters from user input
cout<<"ASCII value of a character :"<<int(c);
//int(c) is displays the integer value of a character
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
char c;
clrscr();
printf("Enter a character:-");
//reads characters from user
scanf("%c",&c);
printf("ASCII value of character= %d", c);
//%d is displays the integer value of a character
getch();
}
2. C++ PROGRAM TO PRINT ASCII VALUES.
#include<iostream.h>
#include<conio.h>
void main()
{
char c;
clrscr();
cout<<"Enter a character:-";
cin>>c; //reads characters from user input
cout<<"ASCII value of a character :"<<int(c);
//int(c) is displays the integer value of a character
getch();
}
No comments:
Post a Comment