To Print ASCII code of all alphabate in C and C++

Bismillahir Rahmanir Rahim
  1. ASCII Table and Description

  2. ASCII ( i/ˈæski/ ASS-kee), abbreviated from American Standard Code for Information Interchange, is a character-encoding scheme. Originally based on the English alphabet, it encodes 128 specified characters into 7-bit binary integers as shown by the ASCII chart on the right.





Solution in C:

#include<stdio.h>
void main()
{
 int i;
 printf("The higher alphabet are : \n");
 for(i=65;i<=90;i++)
   printf("%c-%d\t",i,i);
printf("\nThe lower alphabet are: \n");
 for(i=97;i<=121;i++)
   printf("%c-%d\t",i,i);
}
Solution in C++:

#include<iostream.h>
void main()
{
 int i;
 cout<<"The higher alphabet are : \n";
 for(i=65;i<=90;i++)
{
   cout<<(char)i<<"-"<<i<<"\t";
}
 cout<<"\nThe lower alphabet are: \n";
 for(i=97;i<=121;i++)
{
   cout<<(char)i<<"-"<<i<<"\t";
}
}

Socializer Widget By Blogger Yard
SOCIALIZE IT →
FOLLOW US →
SHARE IT →