Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Area of circle and radius are given how to make program

0 votes
asked Nov 21, 2018 by anonymous
Program in c and java

5 Answers

+1 vote
answered Nov 21, 2018 by Marshall (390 points)
What are you trying to solve for?

Here is a program in c++ that solves for the area.

#include <iostream>
#include <math.h>

int main()
{
    float r;
    std::cout<<"R = ";
    std::cin>>r;
    
    float p = M_PI;
    
    float s = r*r;
    
    std::cout<<"A = ";
    std::cout<<p*s;
}
commented Jun 14, 2020 by rudra (100 points)
#include <stdio.h>
int main()
{
float r,area;
printf("enter the value of r:");
scanf("%f",&r);
area=3.14*r*r;
printf("area=%f",area);
return 0;
}
//this is the c program
0 votes
answered Nov 21, 2018 by Ganesh Tenka (140 points)
/******************************************************************************

If I understood the question correctly , you want to calculate the

area of circle, if radius is given as input.

*******************************************************************************/
#include <stdio.h>

int main()
{
    printf("Hello World");
    unsigned int r;
    printf("\n Enter radius value");
    scanf("%d",&r);
    printf("\n Area of the circle is %f",(float)(3.14*r*r));
    
    return 0;
}
0 votes
answered Jun 13, 2020 by mahesh (470 points)
#include <stdio.h>
main()
{
    int r;
    float area;
    printf("enter the value of r\n");
    scanf("%d",&r);
    area=3.14*r*r;
    printf("the area of circle is: %f",area);
   
   
}
0 votes
answered Jun 13, 2020 by Aparna Tripathi (160 points)
#include<stdio.h>

int main(){

int r=5,a;

float p = 3.14;

a = p* r*r;

printf("%f",a);

return 0;

}
0 votes
answered Jun 18, 2020 by BABLU (140 points)

so what you want to calculate because radius is given and area also given if you want to calculate the value of pi then follow this code.........

#include<iostream>

#include<cmath>
using namespace std;

int main()

{

double area,radius,pi;

cout<<"enter the value of area and radius"<<endl;

cin>>area>>radius;

pi=(area)/(radius*radius);

cout<<"the value of pi"<<pi<<endl;
return 0;

}
 

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...