1 solutions

  • 0
    @ 2025-3-3 16:30:27

    C :

    #include<stdio.h>
    int main()
    {
    int a,b,c;
    double s;
    scanf("%d%d%d",&a,&b,&c);
    s=(a+b+c)/3.0;
    printf("%.3lf",s);
    return 0;
    }
    

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
       int a,b,c;
       cin>>a>>b>>c;
       cout<<fixed<<setprecision(3)<<(a + b +c) / 3.0 <<endl; 
    
    	return 0;
    }
    
    
    

    Java :

    import java.util.Scanner;
    
    public class Main {
    	public static void main(String[] agse) {
    		Scanner sc =new Scanner(System.in);
    		int a =sc.nextInt();
    		int b =sc.nextInt();
    		int c =sc.nextInt();
    		double g =(a+b+c)/3.0;
    		System.out.println(String.format("%.3f",g));
    	}
    }
    

    Python :

    n = input().split()
    x = int(n[0])
    y = int(n[1])
    z = int(n[2])
    a = x + y + z
    print("%.3f" % (a / 3))
    
    • 1

    Information

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