Numerical Methods & Computer Programming Sessional: Presentation On
Numerical Methods & Computer Programming Sessional: Presentation On
Submitted by
Fahad AL Fahim
Section : B
Roll : 1600067
DEPARTMENT OF CIVIL
Program No - 1
A cantilever beam is shown in figure below. A C program is to be written to
compute shear and moment of the beam at every L/N distance from the free end.
5 lb./ft. 72 lb.
77 ft.
x
5 lb./ft. 72 lb.
M
x
V
inc=L/N;
for(x=0;x<=L;x=x+inc)
{ V=(w*x)+f;
M=-((f*x)+(w*x*x*0.5));
printf("at %9f distance from right side shear is = %9f and moment is %9f \n",x,V,M);
}
Program No - 1
5 lb./ft. 72 lb.
FBD
500
450
400
350
Shear (lb.)
300
250
200
150
100
50
SFD
0
80 70 60 50 40 30 20 10 0
-5000
-10000
-15000
-20000
BMD
-25000
Program No - 2
A simply supported beam is shown in figure below. A C program is to be written to
compute shear and moment of the beam at every L/N distance from the free end.
5 lb./ft. x
77 ft.
A B
5 lb./ft. x
77 ft.
Ra Rb
inc=L/N;
for(x=0;x<=L;x=x+inc)
{ V=(w*x)-Rb;
M=((Rb*x )- (w*x*x*0.5));
printf("at %9f distance from right side shear is = %9f and moment is %9f \n",x,V,M);
}
Program No - 2
5 lb./ft.
FBD
192.5 lb. 192.5 lb.
250
200
150
100
Shear in lb.
50
0
-50
SFD -100
-150
-200
-250
80 70 60 50 40 30 20 10 0
DIstance
4000
Bending Moment in lb.ft.
3500
3000
2500
2000
BMD
1500
1000
500
0
80 70 60 50 40 30 20 10 0
Distance
Program No - 3
Three pipes of lengths 800m, 500m and 400m and of diameters 500 mm, 400 mm and
300 mm respectively are connected in series. These pipes are to be replaced by a
single pipe of length 1700 m. Find the diameter of the single pipe
for(i=0;i<3;i++) for(i=0;i<m;i++)
1 2 3
{ {
A= 4 5 6 for(j=0;j<3;j++) C=A+B for(j=0;j<n;j++)
7 8 9 { {
scanf("%d",&A[i][j]);}} C[i][j]=A[i][j]+B[i][j];}}
for(i=0;i<m;i++) OUTPUT
for(i=0;i<3;i++) {
9 8 7 { for(j=0;j<n;j++) 10 10 10
B= 6 5 4 for(j=0;j<3;j++) {printf("\t%d",C[i][j]);} 10 10 10
3 2 1 { printf("\n"); 10 10 10
scanf("%d",&B[i][j]);}}
Program No - 5
Write a C program to print the following : 10 20 30 40 50 60 70 80 90 100
for(i=10;i<=100;i+=10)
{
printf("%d \t",i); // body of the loop
}
Output
10 20 30 40 50 60 70 80 90 100
Program No - 6
A program is to be written that reads a floating‐point number and then displays right ‐most digit
of the integral part of the number