1. 1.Write a program to calculate the area of rectangle.
WRITTEN program;
read(*,*)l,b
area=l*b
write(*,*)area
stop
end
2.To convert the Cartesian coordinates (x,y) in to the poler coordinate(r,Ɵ) and its converse also.
WRITTEN program;
read(*,*)x,y
R=sqrt(x**2+y**2)
THETA=Atan(y/x)
x=R*cos(THETA)
y=R*sin(THETA)
write(*,*)R,theat,x,y
stop
end
3.Find the volume of the cylinder .
WRITTEN program;
pi=3.14
read(*,*)r,h
volume=pi*(r**2)*h
write(*,*)volume
stop
end
4.Find the surface area OF CYLINDER.
WRITTEN program;
pi=3.14
read(*,*)r,h
surface area=2*pi*r*h
write(*,*)surface area
stop
end
5.To find the lcm and hef of two given positive integer m,n.
WRITTEN program;
read(*,*)m,n
i=m*n
10 ir=mod(m,n)
if(if.eq.0)go to 20
n=m
m=ir
go to 10
20 l=i/m
write(*,*)l,m
stop
end
6.To find wither a positive n is prime or not.
WRITTEN program;
read(*,*)n
do10k=2,n/2
if(mod(n,k).eq.o)go to 100
10 continue
write(*,*)'n is a prime number'
stop
100 write(*,*)'n is not a prime number'
stop
end
7.To find the equivallent resistance r for three resistance r1,r2,r3 connected in parallel.
WRITTEN program;
read(*,*)r1,r2,r3
r=(r1*r2*r3)/(r1*r2+r2*r3+r3*r1)
write(*,*)r
stop
end
8.To solve pair of simultaneous linear equation a1x+b1y+c1=0, a2x+b2y+c2=0.
WRITTEN program;
read(*,*)a1,b1,c1,a2,b2,c2
d=((a1*b2)-(a2*b1))
d1=((b2*c1)-(b1*c2))
d2=((c2*a1)-(c1*a2))
x=d/d1
y=d/d2
write(*,*)x,y
stop
end
9.To calculate the perimeter and area of a triangle whose vertex(x1,y1),(x2,y2),(x3,y3).
WRITTEN program;
read(*,*)x1,x2,x3,y1,y2,y3
a=sqrt((x2-x1)**2+(y2-y1)**2)
b=sqrt((x3-x2)**2+(y3-y2)**2)
c=sqrt((x3-x1)**2+(y3-y1)**2)
p=a+b+c
s=p/2.0
area=sqrt(s*(s-a)*(s-b)*(s-c))
write(*,*)p,area
stop
end
10.To find the distance between (x1,y1,z1) and (x2,y2,z3) and direction cosine.
WRITTEN program;
read(*,*)x1,y1,z1,x2,y2,z2
d=sqrt((x2-x1)**2+(y2-y1)**2+(z2-z1)**2)
alfa=(x2-x1)/d
beta=(y2-y1)/d
gama=(z2-z1)/d
write(*,*)d,alfa,beta,gama
stop
end
11.To find first 15 Fibonacci number.
WRITTEN program;
integer f(15)
f(1)=1
f(2)=1
do 100 n=1,13
f(n+2)=f(n+1)+f(n)
100 continue
do 200 n=1,15
write(*,*)f(n)
200 continue
stop
end
12.To check wither a given point (x,y) lies inside or out side the circle x2 +y2-2x-2y=0.
WRITTEN program;
read(*,*)x,y
s=x**2+y**2-2*x-2*y
if(s)10,20,30
10 write(*,*)'point lies inside the circle'
go to 40
20 write(*,*)'point lies on the circle'
go to 40
30 write(*,*)'point lies outside the circle'
go to 40
40 stop
end
13.To find wither the given year is a leap year or not.
WRITTEN program;
INTEGER Y
WRITE(*,*) 'ENTER YEAR'
READ(*,*) Y
IF(MOD(Y,100).NE.0.AND.MOD(Y,4).EQ.0) THEN
WRITE(*,*) 'LEAP YEAR'
ELSEIF(MOD(Y,400).EQ.0) THEN
WRITE(*,*) 'LEAP YEAR'
ELSE
WRITE(*,*) 'NOT A LEAP YEAR'
ENDIF
END
No comments:
Post a Comment