Index-1              Index-2              Home Page

Find Ascii Values

This prints out all acsii values

void main()
{
int i;
i=0;
do
{
printf("%d %c \n",i,i);
i++;
}
while(i<=255);
}

This prints out the acsii value for a given character:
 
void main()
{
int e;
char ch;
clrscr();
printf("\n Enter a character : ");
scanf("%c",ch);
e=ch;
printf("\n The ASCII value of the character is : %d",e);
getch();
}

3 comments:

  1. This prints out all acsii values


    #include
    void main()
    {
    int i;
    for(i=1;i<=255;i++)
    printf(" %d %c\n",i,i);

    }

    ReplyDelete
  2. #include
    void main()
    {
    int i;
    i=0;
    do
    {
    printf("%d %c \n",i,i);
    i++;
    }
    while(i<=255);
    }

    ReplyDelete
  3. #include
    int main()
    {
    int i=1,f=1,num;
    printf("Enter a number: ");
    scanf("%d",&num);
    while(i<=num)
    {
    f=f*i;
    i++;
    }
    printf("Factorial of %d is: %d",num,f);
    return 0;
    }

    ReplyDelete