Showing posts with label c c programming. Show all posts
Showing posts with label c c programming. Show all posts

Printing ASCII value in Hex

//Printing ASCII value in Hex
#include<stdio.h>
#include<conio.h>
int main()
{
char a;
clrscr();
printf("Enter a Character\n");
scanf("\n%c",&a);
printf("\nASCII value in Hex is %x",a);
getch();
return 0;
}

Printing ASCII value of character in decimal

//Printing ASCII value of character in decimal
#include<stdio.h>
#include<conio.h>
int main()
{
char a;
clrscr();
printf("Enter a Character\n");
scanf("\n%c",&a);
printf("\nASCII value in decimal %d",a);
getch();
return 0;
}


To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.

Program to find the ASCII values of the \n,\r,\t,\a,and \b

//Program to find the ASCII values of the \n,\r,\t,\a,and \b
#include<stdio.h>
#include<conio.h>
int main()
{

clrscr();
printf("ASCII value of \\n is =%d",'\n');
printf("\nASCII value of \\r is =%d",'\r');
printf("\nASCII value of \\t is =%d",'\t');
printf("\nASCII value of \\a is =%d",'\a');
printf("\nASCII value of \\b is =%d",'\b');
getch();
return 0;

}

To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.