[solved]C programming | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

18th Mar 2022, 1:35 PM
𝓂𝒶𝓇𝓉𝒾𝓃𝓀𝒾𝓂
𝓂𝒶𝓇𝓉𝒾𝓃𝓀𝒾𝓂 - avatar
7 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]}
19th Mar 2022, 12:59 AM
HungryTradie
HungryTradie - avatar
+ 4
Lemme try then you help me out ☺️
18th Mar 2022, 8:18 PM
𝓂𝒶𝓇𝓉𝒾𝓃𝓀𝒾𝓂
𝓂𝒶𝓇𝓉𝒾𝓃𝓀𝒾𝓂 - avatar
+ 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 ; }
18th Mar 2022, 10:52 PM
𝓂𝒶𝓇𝓉𝒾𝓃𝓀𝒾𝓂
𝓂𝒶𝓇𝓉𝒾𝓃𝓀𝒾𝓂 - avatar
+ 2
Is this homework? The q&a is not for us writing code for you. We help you fix code you already have.
18th Mar 2022, 2:04 PM
Brain & Bones
Brain & Bones - avatar
+ 2
I can't figure out how to incorporate the conversation of meters to km²😥
18th Mar 2022, 10:54 PM
𝓂𝒶𝓇𝓉𝒾𝓃𝓀𝒾𝓂
𝓂𝒶𝓇𝓉𝒾𝓃𝓀𝒾𝓂 - avatar
+ 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
18th Mar 2022, 10:56 PM
HungryTradie
HungryTradie - avatar
+ 1
I did the homework 🔨, can I send it to your teacher 🤓, will I be 1st in class🥇?
18th Mar 2022, 7:52 PM
HungryTradie
HungryTradie - avatar