Some pliz write me a simple program to find the Area and circumference of a circle given that radius is 4 and Pi is 22.7 | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
- 1

Some pliz write me a simple program to find the Area and circumference of a circle given that radius is 4 and Pi is 22.7

17th Oct 2022, 11:09 PM
Cyber Ninja
Cyber Ninja - avatar
22 Antworten
+ 2
SoloLearn is not a code writing service. If you want to write the code, we can help you.
18th Oct 2022, 2:19 AM
Emerson Prado
Emerson Prado - avatar
+ 2
Rather you mean to use Pi = 22.0/7.0, which is a common approximation. Write one function that receives radius and returns 2*Pi*radius. Write another that receives radius also and returns Pi*radius*radius. Show here what you tried, and we'll help you if you need further assistance.
18th Oct 2022, 5:38 AM
Brian
Brian - avatar
+ 2
The operator, ^, is a Bitwise Exclusive Or. There is no operator for exponent in C. The simplest way to square a number in C is to multiply it. float area = PI*radius*radius;
20th Oct 2022, 12:13 AM
Brian
Brian - avatar
+ 1
pi is 22.7 ??? the formula to get an area of a circle is pi * radius ^ 2 the circumference is 2 * pi * radius pi is supposed to be 3.14159. it cannot be changed.
18th Oct 2022, 4:39 AM
Apollo-Roboto
Apollo-Roboto - avatar
+ 1
alright, when asking a question on any online forum, you have to do some work yourself and never expect others to write code for you. I asked "what have you tried" and you are not giving any code! put in as much information as you can in your question so we can know where the problem is... writing a formula for an area and circumference is very basic. We want to know if you are having trouble getting user input, or if there are compilation errors. Maybe you do have some code but it does not give the right answer. give us something so we can help you.
19th Oct 2022, 1:08 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 1
#include<stdio.h> int main () { // data type identifier; int radi ; int PI ; // calculate area of a circle ; radi= 40 ; PI= 3.1428 ; int area= PI * radi ^2 / 2; printf ("area:%d \n" , area) ; return 0;
19th Oct 2022, 6:18 PM
Cyber Ninja
Cyber Ninja - avatar
+ 1
ok thank you for giving some code. I have some reviews for you: you should rename radi to radius. the radius should be a float type. float radius; PI needs to be a float of value 3.14159 float PI = 3.14159; you didn't read my answer that mentions the formula to use for the area of a circle. it should also be a float type. float area = PI * radius ^ 2; your are missing the closing curly braces } after return 0; --- I hope this helps, but you should understand that asking a good question is important. ALWAYS add details, otherwise no one will be able to help. in your case you had syntax errors, along math errors. The original question made it impossible to know these were the problem.
19th Oct 2022, 7:41 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 1
Blaq Mosh For a new question, open a new post
20th Oct 2022, 2:29 AM
Emerson Prado
Emerson Prado - avatar
0
what have you tried? what language do you need help with?
18th Oct 2022, 4:54 PM
Apollo-Roboto
Apollo-Roboto - avatar
0
C
18th Oct 2022, 8:38 PM
Cyber Ninja
Cyber Ninja - avatar
0
Thanks let me try
19th Oct 2022, 7:47 PM
Cyber Ninja
Cyber Ninja - avatar
0
Once I put the float ...and run the program, it shows an error on the word float and says it turns to binary
19th Oct 2022, 10:07 PM
Cyber Ninja
Cyber Ninja - avatar
0
Did it as well still errors
20th Oct 2022, 12:14 AM
Cyber Ninja
Cyber Ninja - avatar
0
Blaq Mosh if you changed the variable type for area from int to float, then the print format specifier also must match. Change %d to %f. print("area: %f\n", area); Keep at it. Teach the computer who is the boss!
20th Oct 2022, 12:28 AM
Brian
Brian - avatar
0
­čĄú­čĄú­čĄú let me see
20th Oct 2022, 12:30 AM
Cyber Ninja
Cyber Ninja - avatar
0
Brian ur right man ­čą░ drop ur number we connect not only here bt on whatsapp too...please
20th Oct 2022, 12:42 AM
Cyber Ninja
Cyber Ninja - avatar
0
It worked??
20th Oct 2022, 12:42 AM
Cyber Ninja
Cyber Ninja - avatar
0
Blaq Mosh, Sololearn is the only social media where I can be found. There is a great community of patient experts and helpers here. Feel free to post more questions, and remember first to show what you tried - even if it doesn't work.
20th Oct 2022, 1:02 AM
Brian
Brian - avatar
0
How can we write program to calculate percentages of 5 subjects
20th Oct 2022, 1:03 AM
Cyber Ninja
Cyber Ninja - avatar
0
Thank u sir
20th Oct 2022, 6:52 AM
Cyber Ninja
Cyber Ninja - avatar