Tuesday, 5 April 2016

C And C++ Program To Display All ASCII Characters from A-Z and a-z Problem Solution.


C Solution:


#include<stdio.h>
/*
    *
    * Prosen Ghosh
    * American International University - Bangladesh (AIUB)
    *
*/
int main(){

    int i;
    for(i = 'A'; i <= 'Z'; i++)
        printf("%c = %d\t%c = %d\n",i,i,(i+32),i+32);

    return 0;
}

C++ Solution:

#include<bits/stdc++.h>
using namespace std;
/*
    *
    * Prosen Ghosh
    * American International University - Bangladesh (AIUB)
    *
*/
int main(){

    for(int i = 'A'; i <= 'Z'; i++)
        cout << (char)i << " = " << i << "\t" << (char)(i+32) << " = "<< i+32 << endl;

    return 0;
}

No comments:

Post a Comment