Question
Please help me solve this. #include #include #include//string.h includes strlen() which returns //the index of the null byte of the C string passed in as
Please help me solve this.
#include
#include
#include//string.h includes strlen() which returns
//the index of the null byte of the C string passed in as an argument
#define SZ 31
int main(void)
{
char entered[] = "Programming Logic 101 Course";
char result[SZ] = { 0 };
int i, j;
for ( j = i = strlen(entered); i > -1; i--, j--)
{
if (isdigit(entered[i]))
{
result[j] = 'b';
}
else if (isspace(entered[j]))
{
result[j] = 'W';
}
else if (isupper(entered[j]))
{
result[j] = 'x';
}
else
{
result[j] = 'Q';
}
}
printf("%s ", result);
return 0;
}
The above code outputs: xQQQQQQQQQQWxQQQQWbbbWxQQQQQQ
It should output:lllllUsnnnsllllUsllllllllllU
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started