#include <stdio.h>
void main()
{
float p,w,a,b,s,m,ss,fs,r1,r2,d,h,q,c,i,x;
printf("Enter the value  distributed load w,point load p,a,b,d,h,x=");
scanf("%f%f%f%f%f%f%f",&w,&p,&a,&b,&d,&h,&x);
r1=(w*a*0.5)-(p*b)/a;
r2=(w*a*0.5)+(p*(a+b))/a;
printf("\n Reaction at point r1=%f",r1);
printf("\n Reaction at point r2=%f",r2);
i=d*h*h*h/12;
q=d*h*h/8;
if(x>=0 && x<=b)
{
s=p;
m=-(p*x);
ss=s*q/i*d;
fs=m*h*0.5/i;
printf("\n shear force=%f,bending moment=%f,ss=%f,fs=%f",s,m,ss,fs);
}
else if(x>=b && x<=(a+b))
{
s=p+(w*(x-b))-r2;
m=-(p*x)+(r2*(x-b))-(w*0.5*(x-b)*(x-b));
ss=s*q/i*d;
fs=m*h*0.5/i;
printf("\n shear force=%f,bending moment=%f,ss=%f,fs=%f",s,m,ss,fs);
}
}