0% found this document useful (0 votes)
5 views

ME Report 3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

ME Report 3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Chittagong University Of Engineering And Technology

Department of Mechanical Engineering

NAME: MUSTAKIM HAIDER


ID: 1803151
LEVEL:1
TERM:2
SECTION:C
GROUP:2
COURSE CODE: ME-182 REMARKS

COURSE TITLE: COMPUTER PROGRAMMING


REPORT NO.: 03
DATE OF SUBMISSION:/10/19
Problem 01:
1 3 5 19
Find sum of the series 2
× 2 × 2 ×… 2 .
1 2 3 10

Code:
REAL SUM

SUM=1

DO 100 K=1,10,1

SUM=SUM*2*K-1/K**2

100 CONTINUE

PRINT*,'SUM=',SUM

STOP

END

Output:
Problem 02:
1 1 1
Find sum of the series 1+ + …+ .
3 5 21

Code:
REAL SUM

SUM=0

DO 100 K=1,21,2

SUM=SUM+1/REAL(K)

100 CONTINUE

PRINT*,'SUM=',SUM

STOP

END

Output:
Problem 03:
Calculate Factorial of 6 (6!).

Code:
REAL SUM

SUM=1

DO 100 K=1,6,1

SUM=SUM*REAL(K)

100 CONTINUE

PRINT*,'FACTORIAL OF 6= ',SUM

STOP

END

Output:
Problem 04:
Write a Fortran program to calculate the value of Π:
2
Π 1 1 1 1
=1+ 2 + 2 + 2 +…+ 2
6 2 3 4 1000

Code:
REAL SUM,PIE

SUM=0

DO 100 K=1,1000,1

SUM=SUM+1/REAL(K**2)

100 CONTINUE

PIE=SQRT(SUM*6)

PRINT*,'PIE=',PIE

STOP

END

Output:

Problem 05:
Find sum of the series as follows 1+ x + x 2+ x 3 +… x k

Code:
REAL SUM,X,K

SUM=0
10 PRINT*,'GIVE THE VALUE OF X '

READ*,X

PRINT*,'GIVE THE VALUE OF K '

READ*,K

DO 100 I=0,K,1

SUM=SUM+X**REAL(I)

100 CONTINUE

PRINT*,'SUM=',SUM

GOTO 10

STOP

END

Output:

Problem 06:
4 9 11
Find value of P= ∑ ∑ ∑ (ka+ mb+ nc)
k=−3 m=0 n=2

Code:
REAL P,A,B,C
P=0

10 PRINT*,'GIVE THE VALUE OF A '

READ*,A

PRINT*,'GIVE THE VALUE OF B '

READ*,B

PRINT*,'GIVE THE VALUE OF C '

READ*,C

DO 100 K=-3,4,1

DO 200 M=0,9,1

DO 300 N=2,11,1

P=P+REAL(K)*A+REAL(M)*B+REAL(N)*C

300 CONTINUE

200 CONTINUE

100 CONTINUE

PRINT*,'SUM=',P

GOTO 10

STOP

END

Output:
Problem 07:
A projectile fired at an angle Ѳ, given an initial velocity of v0, will travel a distance d
2
v0
given byd= ×sin 2 θ Where g is the acceleration constant at 9.8 m/s2. It will be in
g
2 v 0 sinθ
motion for a time t given byt= And reach a maximum height h of
g
2
v 0 sinθ
h=
g

Write a ForTran program which produces a table of the following form for all angles
from 30 to 60 degrees in 5degrees increments and initial velocities from 500 to 1000
m/sec in 100 m/sec increments:

(INTIAL VELOCITY = 500 M/SEC)

ANGLE RANGE TIME HEIGHT


Code:
REAL PI,G,RET,VAL,VALANGLE,VALANGLE2,D,T,H

PI=3.1416

G=9.8

PRINT*,' ANGLE RANGE TIME HEIGHT'

DO 100 I=30,60,5

DO 200 V=500,1000,100

VAL=PI/180

VALANGLE=SIN(2*I*VAL)

VALANGLE2=SIN(I*VAL)

D= V**2/G*VALANGLE

T=2*V*VALANGLE2/G

H=V**2*VALANGLE2/G

PRINT*,I,D,T,H

200 CONTINUE

100 CONTINUE

STOP

END
Output:

You might also like