WAP to jnput the radius of the circle and print the area and circumference. take pie = 3.14
Answers
print("Area:", (pi := 3.14) * (r := float(input("r: "))) ** 2)
print("Circumference", 2 * pi * r)
Program-s:
JAVA:
import java.util.Scanner;
public class Main
{ public static void main(String[] args) {
Scanner scan =new Scanner (System.in);
System.out.println("Enter the radius: ");
int r= scan.nextInt();
System.out.println("The area: "+3.14*r*r)};
System.out.println("The circumference: "+3.14*r*2);}
}
C++:
#include <iostream>
using namespace std;
int main() {
int radius;
cout << "Enter the radius: ";
cin >> radius;
cout << "The area is: " << 3.14*radius*radius << endl;
cout << "The circumference is: " << 3.14*radius*2 << endl;
return 0; }
QBASIC:
CLS
INPUT "ENTER RADIUS: "; R
PRINT "THE AREA: "; 3.14*R*R
PRINT "THE AREA: "; 3.14*R*2
END
Python:
r=int(input("Enter radius: "))
print("The area:", 3.14*r*r)
print("The circumference:", 3.14*r*2)
C:
#include <stdio.h>
#include <math.h>
int main()
{ float r;
printf("Enter the radius: ");
scanf("%f", &r);
printf("Area: %.2f",3.14159*r*r);
printf("Circumference: %.2f",3.14159*r*2);
return 0; }