Write a C program to convert number to alphabet.
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;
}
Output:
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
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