TERMINATING THE SWITCH FUNCTION!!HELP!!

I DID MOST OF THE CODING I JUST COULDNT FIGURE OUT HOW TO LAST SECTION (NUMBER 3)
THANK YOU GUYS!!!


Design a program in C using the SWITCH statement which, when executed, will do the following in the indicated sequence:
1. Ask the user to type on the keyboard a value of the radius of the sphere a.
2. Ask the user to type on the keyboard a value for a runmode operator which will determine which computation will be performed. The following values of the runmode operator and the corresponding computations are to be used:
i) runmode = 1 if the volume of the sphere vsphere = 4πa3/3 is to be computed and outputted to the console;
ii) runmode = 2 if the surface area of the sphere asphere = 4πa2 is to be computed and outputted to the console;
iii) runmode = 3 if the volume of the cube vcube = 8a3 is to be computed and outputted to the console; and
iv) runmode = 4 if the surface area of the cube acube = 24a2 is to be computed and outputted to the console.
3. The above sequence is to be repeated in an infinite loop unless the user inputs a value of 0 for a, in which event the whole process is terminated.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 #include<stdio.h>
#include<math.h>
#define pi 3.14

int main(){
	float a, vsphere, asphere, vcube, acube ;
	int runmode;

	while(1){
		printf("please enter a value for the radius of the sphere:  ");
		scanf("%f",&a);
		
		printf("please enter a value for runmode: 1 to compute volume of sphere, 2 to compute surface area of sphere, 3 to compute volume of cube, 4 to compute surface area of cube:  ");
		scanf("%d",&runmode);

		
		switch(runmode){
			case(1):
				vsphere= (4*pi*a*a*a)/3;
				printf(" the volume of the sphere is: %.2f\n",vsphere);
				break;
			case(2):
				asphere=(4*pi*a*a);
				printf(" the surface area of the sphere is: %.2f\n",asphere);
				break;
			case(3):
				vcube=(8*a*a*a);
				printf("the volume of the cube is: %.2f\n",vcube);
				break;
			case(4):
				acube=(24*a*a);
				printf("the surface area of cube is: %.2f\n",acube);
				break;
			
				
		 }
	}
	return 0;
}

1
2
3
do{
    ...
} while(a > 0);
im sorry i am a beginner what do i have to do with "do" ?

a>0 is a great idea it obviously didnt work when i just used that in while

can you please be more clearer?
thank you so much for your time!!
thank you !!!
Topic archived. No new replies allowed.