Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a printf or scanf statement for each of the following: a. Print unsigned i

ID: 3636507 • Letter: W

Question

Write a printf or scanf statement for each of the following:
a. Print unsigned integer 40000 left justified in a 15 – digit field with 8 digit.
b. Read a hexadecimal value into a variable hex.
c. Print 200 with and without a sign
d. Print 100 in hexadecimal form preceded by 0x
e. Read characters into array str until the letter p is encountered
f. Print 1.234 in a 9-digit field with preceding zeros.
g. Read a time of the form hh:mm:ss, storing the parts of the time in the integer variables hour,
minute and second. Skip the colons (:) in the input stream, and display them. Use the
assignment-suppression character.
h. Read a string of the form “characters” from the standard input. Store the string in character
array str. Eliminate the quotation marks from the input stream and display it.
i. Read a time of the form hh:mm:ss, storing the parts of the time in the integer variables hour,
minute and second. Skip the colons(:) in the input stream and display it. Do not use the
assignment-suppression character.

Explanation / Answer

a. printf(” 01234567890123456789 %-13u”,40000); b.scanf("%x",&hex); c. Answer - With a sign: printf ("%+d ", x); Answer - Without a sign: printf ("%d ", x); d.printf("0x%x ",100); e. Answer: char s[30]; printf ("Please enter a series of characters: "); scanf ("%[^p]", s); f. printf("%9f ",1.234); h.scanf("%[^?]",str); i.scanf("%d:%d:%d", &hour,&minute, &second);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote