#include <stdio.h>

void main()
    {
        float r1,r2,w,b,h,l1,l2,q,i,v,m,ss,bs,x;

        printf("Enter the value of distributed load= ");
        scanf("%f",&w);
        printf("Enter the value of distance= ");
        scanf("%f",&x);
        printf("Enter the value l1,l2=\n");
        scanf("%f%f",&l1,&l2);
        printf("Enter the value b,h=\n");
        scanf("%f%f",&b,&h);

        r1=(w*l2*l2*0.5)/(l1+l2);
        r2=(w*l2*(l1+(l2*0.5)))/(l1+l2);

        printf("\nThe value of reaction r1=%f, r2=%f",r1,r2);

        q=b*h*h*0.5*0.25;
        i=b*h*h*h/12;

        if(x<l1)
        {
            v=r1;
            m=r1*x;
            ss=(v*q)/(i*b);
            bs=m*h*0.5/i;
        }

        else if (x>=l1 && x<=l2)
        {
            v=r1-w*(x-l1);
            m=(r1*x)-(w*(x-l1)*(x-l1)*0.5);
            ss=(v*q)/(i*b);
            bs=m*h*0.5/i;
        }

    printf("\nThe value of shear force=%f,\nbending moment=%f,\nss=%f,\nbs=%f",v,m,ss,bs);
    }