How to calculate diameter, circumference and area of a circle by using radius---
Hello!
I have been trying to learn C language.I bought a book "C How to Program,Deitel&Deitel"...I make practise by myself,but sometime it get harder for me...i searched good examples on the internet.i have two example of four,which i couldnt do.these are;
1) Write a program that declares 2 floating point numbers and initializes them to 1.5 and 5.5 respectively. Find the multiplication and sum of both those numbers and print the results on screen.
2)Write a program that enters the radius of a circle and prints the circle’s diameter, circumference and area. Perform each of these calculations inside the printf statements.
Somebody help me?I think,i did everything what i must to do..but is doesnt work =(
9 22425
How to calculate diameter, circumference and area of a circle by using radius---
Hello!
I have been trying to learn C language.I bought a book "C How to Program,Deitel&Deitel"...I make practise by myself,but sometime it get harder for me...i searched good examples on the internet.i have two example of four,which i couldnt do.these are;
1) Write a program that declares 2 floating point numbers and initializes them to 1.5 and 5.5 respectively. Find the multiplication and sum of both those numbers and print the results on screen.
2)Write a program that enters the radius of a circle and prints the circle’s diameter, circumference and area. Perform each of these calculations inside the printf statements.
Somebody help me?I think,i did everything what i must to do..but is doesnt work =(
Hi,
What difficulties you are encountering? Please post your efforts here. There are some formulas of circle. You just need to apply them in C. everything is given here so describe your exact problem.
Regards
PS Read posting guidelines
I have nothing about the first question...but i made something for the second one..
" - #include <stdio.h>
-
-
int main()
-
-
{
-
int pi,radius,diameter,circumference,area;
-
-
printf("Enter the radius of the circle\n");
-
scanf("%d",&radius);
-
-
pi=3,14;
-
diameter=radius*2;
-
circumference=2*pi*radius;
-
area=pi*radius*radius;
-
-
scanf("%d%d%d",&diameter,&circumference,&area);
-
-
return 0;
-
}
"
I have nothing about the first question...but i made something for the second one..
"
Do you not understand the question? (Quite honestly, I think the second question was trickier than the first.) Why is the first question giving you problems?
The first one is too easy.
The second one maybe something like this
[ spoonfeeding code removed ]
int pi
There is some biblical 'evidence' (mind the quotes) that this should be true but
the entire mathematical world thinks otherwise.
kind regards,
Jos
Sorry for that, I am new and I just read the guidelines. This will not be repeated.
Do you not understand the question? (Quite honestly, I think the second question was trickier than the first.) Why is the first question giving you problems?
is this important which one is easier?these are my efforts.i tried to do something.but i cant...
Banfa 9,065
Expert Mod 8TB
is this important which one is easier?these are my efforts.i tried to do something.but i cant...
Actually it is important, because what you learn by doing question 1 you will use in solving question 2, which is probably why they were set in that order.
is this important which one is easier?these are my efforts.i tried to do something.but i cant...
The comment wasn't ment to undermind your efforts at all. I'm just confused why you are stuck since you did the second one with no help from this forum.
Maybe this might help you. The first problems uses the exact same principles as the second except changes what you are looking for. Instead of finding the area, you are creating a number that is the addition of the two given variables and a multiplication of the two.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Talon |
last post by:
Hi all,
I am new to Tk, so please bear with me. I need someone better at math
than me to help me figure this out. I am drawing multiple arcs on the
same circle. All arcs start at 90 and have...
|
by: Pythor |
last post by:
I wrote the following code for a personal project. I need a function
that will plot a filled circle in a two dimensional array. I found
Bresenham's algorithm, and produced this code. Please tell...
|
by: jdcrief |
last post by:
Complier: Visual C++ 2005 Express Edition
The program I wrote will compile and execute, but the output is always
the same, no matter what number is entered in for the radius of the
circle. ...
|
by: wrestling god |
last post by:
Hey everyone, kinda struggling with a part of my hw assignment. would anyone know how I could get started.?? here is the question:
Graphical Determination of Pi: The full value of pi, which no...
|
by: heterodon7 |
last post by:
hello,
can anyone give me a clue or simple code on task:
for example we have in 2D an equation fo circle:
(x - 3)^2 + (y - 4)^2 = 25.
now the program must return for example a 40 pairs of...
|
by: ccaddiso |
last post by:
I want to retrieve my x1, x2, y1, and y2 from a text file using getline, but i don't know how.
const double PI = 2.0 * asin(1.0);
// class declaration
class Point
{
protected:
|
by: tiffrobe |
last post by:
I'm a little lost on my program. Everything works fine except function 3. It gives out garbage numbers. Its suppose to give the distance between two points and then the area of 2 circles.
...
|
by: Prime Mover |
last post by:
Hello all,
I have got the pseudo-code below that I would like to convert to c
language. The algorithm calculates Pi value. I am somewhat familiar
with C language, but I am just starting to learn...
|
by: cmwb2000 |
last post by:
Hi
I am trying to calculate the radius of a circle of best fit from 2 or 3 mouse positions. At present I am recording a series of points a mouse passes, I intended to pick the first and last point...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| | |