This blog is under construction

Saturday, 6 July 2013

C program to convert numeric to alphabetic

Write a C program to convert number to alphabet.

  #include <stdio.h>
  int main() {
        int num, ch = 1;
        while (ch) {
                printf("Enter your input number:");
                scanf("%d", &num);
                if ((num >= 'a' && num <= 'z') ||
                        (num >= 'A' && num <= 'Z')) {
                        printf("Equivalent character: %c\n", num);
                } else {
                        printf("Not a valid ascii value!!\n");
                printf("Do you want to continue(1/0):");
                scanf("%d", &ch);
        return 0;

  jp@jp-VirtualBox:~/$ ./a.out
  Enter your input number:65
  Equivalent character: A
  Do you want to continue(1/0):1
  Enter your input number:98
  Equivalent character: b
  Do you want to continue(1/0):0

No comments:

Post a Comment