Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Type the following program and run it. #include #include int main(void) { char name[80]; printf(Enter your full name : ); gets(name); printf( Your name is
- Type the following program and run it.
#include
#include
int main(void)
{
char name[80];
printf("Enter your full name : ");
gets(name);
printf(" Your name is %s ", name);
system(pause);
return (0);
}
- For the above program, what happens if you use scanf to enter the full name? Why?
- Modify the program to print your name using a function.
- Modify the program to count the number of characters in the name and display both the name and the number of characters. Do not count spaces as characters. The ASCII code for a space is 3210 or ' ' as a character. The program must have two separate functions to count the number of characters and to display the result.
- Modify the program to the strlen function in the string.h library rather than the character counting function. Note that the number of characters now includes spaces.
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