1 solutions

  • 0
    @ 2025-11-5 15:09:32

    C :

    #include<stdio.h>
    
    int main()
    {
    	float a,b;
    	scanf("%f",&a);
    	if(a<=10){
    		b=a*1.50;
    		printf("%.2f",b);
    	}else{
    		b=(a-10)*1.20+10*1.5;
    		printf("%.2f",b);
    	}
    	return 0;
    }
    

    C++ :

    #include <iostream>
    #include <cstdio>
    using namespace std;
    int main()
    {
        double weight,ans;
        cin>>weight;
        if(weight<=10)
        {
            ans=weight*1.5;
        }
        else
        {
            ans=10*1.5+(weight-10)*1.2;
        }
        printf("%.2lf\n",ans);
        return 0;
    }
    
    • 1

    Information

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