Question #11674

Problem Statement: You are required to write a program that prompts the user to enter the radius of circle as an input and display the circle’s diameter, circumference and area. Use the constant value 3.14159 for л. Perform each of these calculations inside the printf statements and use the conversion specifier %f.
(a) Write a pseudo-code to solve this problem.
(b) Write a full program using C programming language to solve this problem.

Expert's answer

Pseudo-code:

take radius

print radius²·pi

print 2pi·radius

# include<iostream.h>

# include<conio.h>

double pi = 3.1419, r;

void main(){

cout<<"Enter the radius of a circle: ";

cin>>r;

printf("The diameter of a circle is %f \n", 2*r);

printf("The area of a circle is %f \n", pi*r*r);

printf("The circumference of a circle is %f \n", 2*pi*r);

getch();

}

take radius

print radius²·pi

print 2pi·radius

# include<iostream.h>

# include<conio.h>

double pi = 3.1419, r;

void main(){

cout<<"Enter the radius of a circle: ";

cin>>r;

printf("The diameter of a circle is %f \n", 2*r);

printf("The area of a circle is %f \n", pi*r*r);

printf("The circumference of a circle is %f \n", 2*pi*r);

getch();

}

## Comments

## Leave a comment