1 solutions

  • 0
    @ 2025-11-5 16:54:24

    C :

    #include <stdio.h>
    #include <math.h>
    int main()
    {
        int r;
    	double s, PI;
    	while (scanf("%d", &r) != EOF){
    	PI = atan(1.0) * 4;
        s = PI * r * r;
        printf("%.7lf\n", s);
    	}
        return 0;
    }
    

    C++ :

    #include<stdio.h>
    #include<string.h>
    #include<stdlib.h>
    #include<math.h>
    
    int main()
    {
    
    int m;
    	double s=0;
    	double PI;
    	//tan(PI/4)==1;
    	PI=atan(1)*4;
    	while(scanf("%d",&m)!=EOF)
    	{
     
    		s=PI*m*m;
    
            printf("%.7f\n",s);
    
    	}
    
    
    return 0;
    
    }
    
    

    Java :

    import java.util.Scanner;
    
    
    public class Main {
    
    	public static void main(String[] args) {
    		final double PI=Math.PI;
    		Scanner s = new Scanner(System.in);
    		while(s.hasNext()){
    		double r = s.nextDouble();
    		System.out.println(String.format("%.7f", PI*r*r));
    			
    		}
    
    	}
    
    }
    
    • 1

    Information

    ID
    18058
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By