#include<stdio.h>
void main()
{
  float L1,L2,L3,w1,d,h,r1,c,i,q,x,v,m,bm,ss,bs;
  printf("Enter the value of L1,L2,L3,w1,m,d,h,x:\n");
  scanf("%f%f%f%f%f%f%f%f",&L1,&L2,&L3,&w1,&m,&d,&h,&x);
    c=h/2;
    i=(d*(h*h*h))/12;
    q=d*(h/2)*(h/4);
    r1=((w1*L1)*((L2+L3)*L1*0.5))-m/(L1+L2+L3);
if(x>=0&&x<=L1)
    {
        v=r1-w1*x;
    bm=r1*x-w1*x*x*0.5;
    ss=(v*q)/(i*d);
    bs=(bm*c)/i;
    }
else if(x>L1&&x<L2)
    {
        v=r1-w1*L1;
    bm=r1*x-w1*L1*(x-L1/2);
    ss=(v*q)/(i*d);
    bs=(bm*c)/i;
    }
else
{
    v=r1-w1*L1;
    bm=r1*x-w1*L1*(x-L1/2)+m;
    ss=(v*q)/(i*d);
    bs=(bm*c)/i;
}
printf("\nShear force=%f",v);
printf("\nBending moment=%f",bm);
printf("\nShearing stress=%f",ss);
printf("\nBending stress=%f",bs);
}
