C / C++ Program to Print All The ASCII Character & Their Equivalent Integer Value

/* The following program will run from 0 to 255, which is the overall range of the Character set. Likewise the program will print the number & the corresponding ASCII character. The 2nd for loop is for formatting the print pattern & the 1st one is for printing the ASCII character & the corresponding integer number. */

//CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k=0,l=0;
printf("\n");
for(i=0;i<=255;i++)
{
printf("%5d%2c",k,k);
k++;
l++;
if(l==11)
{
    l=0;
for(j=1;j<=2;j++)
printf("\n");
}
}
getch();
}


Screenshot:
C / C++ Program to Print All The ASCII Character & Their Equivalent Integer Value
C / C++ Program to Print All The ASCII Character & Their Equivalent Integer Value

1 comment:

  1. TRY THIS.....
    #include
    #include
    #include
    void main()
    {clrscr();
    int i;
    cout<<"THE ASCI VALUES ARE_____________________________________________";
    for(i=0;i<=237;i++) //I used 237 as a random number try 225 for most cases
    {if(i<100) //For a clean space
    {cout<<" "<<i;
    putchar(i);
    cout<<" ";
    }
    else
    {cout<<" "<<i;
    putchar(i);
    }
    }getch();
    } //This is just an alternative method please give this a try too

    ReplyDelete