Search the web to find a list of scanf identifiers


For the code below, 
a) Explain which, if any, of the statements are directives, type declarations, assignments, or comments. 
b) There are one or more bugs in the code. Find it (them), describe it (them), and explain the fix. 
c) Briefly, describe what each statement does, and what does the complete code does. 
#include
#include

int main()
{
float far, cent ;
printf(" Enter cent: ") ; //enter the value of cent
scanf("%f", ¢)
far=9.0*cent/5.0 + 32.0 ;
printf("n far = %d", far);

return 0;
} // Try running your code with some known numbers to
// make sure you've found everything

3. Search the web to find a list of scanf identifiers (similar to the one for printf 
identifiers on slide 34 of the lecture) and do the following 
a) Find and describe the identifier for an unsigned hexadecimal integer (in 
hexadecimal, the numbers above 9 are represented by A (or a) for 10, B 
(or B) for 11...,F (or f) for 15). 
b) Write the code to 
i. skip a line, indent one space, then print "Enter the hexadecimal 
number:x" ii. use scanf to input the number entered from the keyboard
(remember to use the identifier that you've just found) 
iii. print the number in hexadecimal format using the appropriate 
identifier from slide 34. 
c) Debug and run your code using the hexadecimal number 1a3 as an input. 
d) Finally, change the format in the second print statement to %d. What 
happens? Can you figure out why? 

4. Write, debug and run the code to calculate the length of the hypotenuse, c, of a 
right triangle of sides a and b. Your code should do the following: 
a) Requests the values of two floating point numbers, a and b, from the 
keyboard 
b) Calculate the hypotenuse, c, fromc= sqrt a^2+b^2
c) Print the values of a, b, and c as 
"a = value of a, b = value of b, c = value of c", 
where value of a, etc. indicates the actual numerical value. 
Test you code with a few different values of a and b.  

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Search the web to find a list of scanf identifiers
Reference No:- TGS081620

Expected delivery within 24 Hours