In: Computer Science
A C program that will perform the following:
Input the string: Abc_3_deF
Expected Output:
The string you entered is: aBC_Three_DEf
An output for just this specific input will be fine. If you want to provide a program for all outputs, it would help with my understanding of how the program works overall as well but it is not needed. Thanks!
#include <stdio.h>
#include <stdlib.h>
int main() {
char *arr[10] = {"", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"};
char str[20] = "Abc_3_deF";
int i = 0;
while(str[i]){
if(str[i] >= 'a' && str[i] <= 'z')
printf("%c", str[i] - 32);
else if(str[i] >= 'A' && str[i] <= 'Z')
printf("%c", str[i] + 32);
else if(str[i] >= '0' && str[i] <= '9'){
printf("%s", arr[str[i] - '0']);
}
else
printf("%c", str[i]);
i++;
}
printf("\n");
return 0;
}
========================================
SEE OUTPUT
Thanks, PLEASE COMMENT if there is any concern.