Sort by

recency

|

199 Discussions

|

  • + 0 comments

    THIS IS MINE:

    const PI = Math.PI, r = parseFloat(readLine());
        
        console.log(PI * r ** 2);
        console.log(2 * PI * r);
    
  • + 0 comments

    try {
    // Attempt to redefine the value of constant variable PI PI = 0; // Attempt to print the value of PI console.log(PI); } catch(error) { console.error("You correctly declared 'PI' as a constant."); } this try causing additional console as 0 and leading to wrong answer what i can do

  • + 0 comments

    const PI = Math.PI; const r = parseFloat(readLine());

    let area = PI * r * r console.log(area)

    let perimeter = 2 * PI * r console.log(perimeter)

  • + 0 comments
    const PI = Math.PI;
    const r = readLine();
    
    // Print the area of the circle:
    console.log(`${PI * Math.pow(r, 2)}`);
    
    // Print the perimeter of the circle:
    console.log(`${2 * PI * r}`);
    
  • + 0 comments

    const PI = Math.PI

    // Write your code here. Read input using 'readLine()' and print output using 'console.log()'.
    const input = readLine()
    
    // Print the area of the circle:
    const circleArea = PI * input**2
    console.log(circleArea)
    
    
    // Print the perimeter of the circle:
    const circlePerimeter = 2 * PI * input
    console.log(circlePerimeter)