Question
1.1) There are numerous opportunities for error in any program, many times in places that seem too simple to require close attention. What do you
1.1) There are numerous opportunities for error in any program, many times in places that seem too simple to require close attention. What do you think the following program is supposed to do?
#include stdio.h int main() { double radius = 11; /* Centimeters double pi = 3.14159 double sphere_volume = (4 / 3) * pi *(radius * radius * radius); double surface_area = 5 * pi * radius; printf("Volume = %.2f", sphere_volume); printf("Area = %.2f", surface_area); return 0; }
1.2) Using Visual Studio:
Create a new empty Visual C++ Console Application project
Add a C source file (e.g., Source.c) to the project
Copy the code from Lab 1.1 into the source file.
Try compiling the program. What were the results? What error messages did you receive?
1.3) Fix the syntax errors in the program from Lab 1.1. What do you receive for output when you run the program?
1.4) The program from Lab 1.3 has two logic errors. Fix them both and show the corrected program. NOTE: the correct formulas for a sphere's volume V and a sphere's surface area A area:
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