C++ Level 1 Practice BCQM3035: Real Number Calculations for National Day Holiday

GESP Learning Resource List
Real Questions Practice Questions Syllabus Analysis
Level 1 Real Questions List Level 1 Practice Questions List Level 1-5 Syllabus Analysis
Level 2 Real Questions List Level 2 Practice Questions List Essential Skills for GESP/CSP Programming
Level 3 Real Questions List Level 3 Practice Questions List
Level 4 Real Questions List Level 4 Practice Questions List
Level 5 Real Questions List Level 5 Practice Questions List
CSP Learning Resource List
CSP-XL
2025 Liaoning CSP-XL Re-examination Real Questions Analysis

Floating-point calculations to find the volume of a sphere.

BCQM3035 Real Number Calculations for National Day Holiday

Problem Requirements

Description

A sphere is a common model, and we all know its volume calculation formula: for a sphere with radius , the volume calculation formula is , where is taken as . Given , find .

Input

The input is a non-negative real number not exceeding 100, which is the radius of the sphere.

Output

The output is a real number, which is the volume of the sphere, rounded to 2 decimal places.

Input Example

4

Output Example

267.95

Problem Analysis

This is a standard calculation problem. Based on the formula provided for the sphere, simply calculate the volume of the sphere. It is important to note that both input and output are real numbers which means floating-point variables should be used, and one should not be misled by the input example to use <span>int</span> instead.

For my child, he used <span>int</span> for the input, and although it passed the checkpoints, it still deviated from the problem’s intent. However, he has progressed from not being able to solve such problems to being able to complete these low-difficulty problems independently, which I am pleased with.

Example Code

#include <cstdio>int main() {    double v = 0;          // Define variable v to store the volume of the sphere, initialized to 0    double r;              // Define variable r to store the radius of the sphere    scanf("%lf", &r);      // Read the input radius value    v = 4.0 / 3.0 * 3.14 * r * r * r;  // Calculate the volume of the sphere using the formula V=4/3*π*r³    printf("%.2f", v);     // Output the result, keeping two decimal places    return 0;}

【Recommended】Mobile Version:【GESP】C++ Certification Learning Resource Summary

【Recommended】Desktop Version:: GESP/CSP Examination Materials Website:https://wiki.coderli.com/ A dictionary-style resource organization for easy and quick access.

C++ Level 1 Practice BCQM3035: Real Number Calculations for National Day Holiday

luogu-” series problems can be evaluated online at Luogu Problem Bank.

bcqm-” series problems can be evaluated online at Programming Enlightenment Problem Bank.

.cls-1{fill:#001e36;}.cls-2{fill:#31a8ff;}.cls-1{fill:#001e36;}.cls-2{fill:#31a8ff;}.cls-1{fill:#001e36;}.cls-2{fill:#31a8ff;}.cls-1{fill:#001e36;}.cls-2{fill:#31a8ff;}.cls-1{fill:#001e36;}.cls-2{fill:#31a8ff;}.cls-1{fill:#001e36;}.cls-2{fill:#31a8ff;}

Leave a Comment