#include<stdio.h>

void main()
    {
       float a,b,c,ra,rb,m,p,x,w,v,ss,flex,q,B,h,i,C,M;
       printf("Input the values of a,b,c,m,p,w,h,B,x\n");
       scanf("%f%f%f%f%f%f%f%f%f",&a,&b,&c,&m,&p,&w,&h,&B,&x);

       ra = ((w*pow((a+b),2))-2*m-2*p*c)/(2*(a+b));
       rb = ((w*pow((a+b),2))+2*m+2*p*(a+b+c))/(2*(a+b));
       if(x>0 && x<=(a+b)/2){
       v = ra-(w*x);
       M= ra*x-(w*x*x/2);
       }
       else if(x<=(a+b) && x>=(a+b)/2){
       v = ra-(w*x);
       M= ra*x-(w*x*x/2)+m;
       }
       else if(x>(a+b) && x<=(a+b+c)){
       v = ra-(w*(a+b))+rb;
       M= ra*x+m+rb*(x-(a+b))-(w*(a+b)*(x-((a+b)/2)));
       }
       q= b*h*h/8;
       i= b*pow(h,3)/12;
       C= h/2;
       flex = m*c/i;
       ss= v*q/(i*B);

       printf("At %f shear force is %f\n bending moment is %f\n shear stress is %f\n flexural stress is %f ",x,v,M,ss,flex);

    }
