This is just an example. Your program must print the first three letters of your
ID: 3672575 • Letter: T
Question
This is just an example. Your program must print the first three letters of your name. Design your printf statements carefully to create enough black lines at the beginning and end to make your initials readable. Use comments in your program to enhance readability as shown in this chapter. Write a program that reads a character, an integer, and a floating -point number. It then prints the character, first using a character format specification (%c) and then using an integer specification (%d). After printing the character, it prints the integer and floating -point numbers on separate lines. Be sure to provide complete instructions (prompts) for the user.Explanation / Answer
int main()
{
char c;
int i;
float f;
printf ("Please enter a character: ");
scanf ("%c", &c);
printf ("Please enter an integer: ");
scanf ("%d", &i);
printf ("Please enter a floating point number: ");
scanf ("%f", &f);
printf ("The value of c is %c. ", c);
printf ("The value of i is %d. ", i);
printf ("The value of f is %f. ", f);
printf ("The address of c is %p. ", &c);
printf ("The address of i is %p. ", &i);
printf ("The address of f is %p. ", &f);
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.