+ 4
[solved]C programming
A C Program that promts the user to enter the radius of a circle in meters & computes the area of a circle.The program then uses a function to convert the area into square kilometres (KM)ยฒ the program display the area in kilometres squared. Hint 1Kmยฒ = 1000000mยฒ https://code.sololearn.com/cUf3EDVAC52V/?ref=app
9 Answers
+ 2
printf("The area of the circle is : %.3f kmยฒ" ,result/1000000.0 );
//you know %f gives a float, the .3 makes it print only 3 places after the decimal point.
{Edit: A bit of housekeeping. If this is a success, you can be a champion ๐ฅ of the Q&A forum if you edit your original post to start with [Solved]}
+ 4
Lemme try then you help me out โบ๏ธ
+ 3
#include <stdio.h>
float aoc(float );
int main()
{
float r,result;
printf ("Enter radius of a circle in meters : \n");
scanf("%f",&r);
result = aoc(r);
printf("The area of the circle is :%f" ,result );
return 0;
}
float aoc(float q)
{
float area , pi;
pi=3.14;
area= pi*q*q;
return area ;
}
+ 2
Is this homework?
The q&a is not for us writing code for you. We help you fix code you already have.
+ 2
I can't figure out how to incorporate the conversation of meters to kmยฒ๐ฅ
+ 2
G'day Martinkim could you copy+paste that code into a SoloLearn "code bit" then edit that post to have a link to your code bit instead of the code in the text. Much much easier for us to help you....
https://www.sololearn.com/discuss/333866/?ref=app
+ 1
I did the homework ๐จ, can I send it to your teacher ๐ค, will I be 1st in class๐ฅ?