Description
Please review the following code below. List and discuss at least three reasons to why you believe the code is poorly formatted. Once you have identified any formatting issues, rewrite the program to include what you believe to be accurate. Feel free to run the code in Visual Studio C++ to see the output. (100 points)
#include
int main()
{
int x1, x2, x3;
printf("Centigrade to Fahrenheit temperature table\n\n");
for(x1 = -2 ; x1 <= 12 ; x1 = x1 + 1)
{
x3 = 10 * x1;
x2 = 32 + (x3 * 9) / 5;
printf(" C =%4d F =%4d ", x3, x2);
if (x3 == 0)
printf(" Freezing point of water");
if (x3 == 100)
printf(" Boiling point of water");
printf("\n");
}
return 0;
}
Explanation & Answer
1) line 1 #include -> it should be #include <stdio.h>2) Proper indentation of the code is absent3) 2 if statements are used instead of if - else if statement4) comments are absent in th...
Review
Review
24/7 Homework Help
Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!
Similar Content
Related Tags
The English Patient
by Michael Ondaatje
Ethan Frome
by Edith Wharton
All Quiet on the Western Front
by Erich Maria Remarque
Faust
by Johann Wolfgang von Goethe
50 Shades of Grey
by E. L. James
The Call of the Wild
by Jack London
Robinson Crusoe
by Daniel Defoe
Death on the Nile
by Agatha Christie
The Old Man and the Sea
by Ernest Hemmingway