You are on page 1of 4

1.

c program for summing fifth integer IMPLICIT REAL (A-H,O-Z) SUM=0 Do i=3,100,5 IF(i<100)THEN SUM=SUM+i END IF END DO write(*,*)"SUM=",SUM stop end

4.
c

program for calculation of mean for first n numbers IMPLICIT REAL (A-H,O-Z) write(*,*)'enter the value of n=' read (*,*) n SUM=0 Do i=1,n,1 SUM=SUM+i END DO amean=SUM/n write(*,*)"Mean=",amean stop end

4a.
c

program for calculation of mean integer n real mean,SUM write(*,*)'enter the value of n=' read (*,*) n SUM=0 Do i=1,n,1 SUM=SUM+i END DO mean=SUM/n write(*,*)"Mean=",mean stop end

4b.
c program for calculation of mean for a set of intergers IMPLICIT REAL (A-H,O-Z) dimension x(25) write(*,*)'enter the value of n=' read (*,*) n write (*,*)'enter the numbers x(i):' read(*,*)(x(i),i=1,n) SUM=0 Do i=1,n,1 SUM=SUM+x(i) END DO amean=SUM/n

write(*,*)"Mean=",amean stop end

4c.
c program for calculation of mean integer n real mean,SUM write(*,*)'enter the value of n=' read (*,*) n SUM=0 Do i=1,n,1 SUM=SUM+i END DO mean=SUM/n write(*,*)"Mean=",mean sd=(i-mean)**2/n write(*,*)"standard deviation=",sd stop end

4d.
c program for calculation of mean and sd IMPLICIT REAL (A-H,O-Z) dimension x(25) write(*,*)'enter the value of n=' read (*,*) n write (*,*)'enter the numbers x(i):' read(*,*)(x(i),i=1,n) SUM=0 Do i=1,n,1 SUM=SUM+x(i) END DO amean=SUM/n write(*,*)"Mean=",amean sd=(x(i)-amean)**2/n write(*,*)"standard deviation=",sd stop end

5a
c

program for determination of number positive integer coordinates IMPLICIT REAL (A-H,O-Z) x=35**1./2. number=0 do i=0,x do j=0,x dis=i**2+j**2 if (dis<35) then number=number+1 end if end do end do write(*,*)"number of positive coordinate=",number stop end

5b.
c

program for determination of number all integer coordinates IMPLICIT REAL (A-H,O-Z) x=35**1./2. number=0 do i=-x,x do j=-x,x dis=i**2+j**2 if (dis<35) then number=number+1 end if end do end do write(*,*)"number of positive coordinate=",number stop end

6.
c program for polynomial IMPLICIT REAL (A-H,O-Z) Do x=-5,5,0.5 Do y=-5,5,0.5 z=x**5+5*(x**4)*y+10*(x**3)*y*y+10*x*x*(y**3)+5*x*y**4+y**5 END Do END Do write(*,*)"z=",z stop end

7a.
c

program for summing pi IMPLICIT REAL (A-H,O-Z) SUM=0.0 Do p=1,1000,1 SUM=SUM+1/(p*p) END Do pi=SQRT(6*SUM) write(*,*)"pi=",pi stop end program for summing pi IMPLICIT REAL (A-H,O-Z) SUM=0.0 Do p=1000,1,-1 SUM=SUM+1/(p*p) END Do pi=SQRT(6*SUM) write(*,*)"pi=",pi stop end

7b.
c

10.
c program find roots of quadratic equation IMPLICIT REAL (A-H,O-Z) write(*,*)'enter the values of a,b,c for ax^2+bx+c' read (*,*) a,b,c d=b*b-4*a*c IF (d.gt. or .eq.0.0)THEN r1=(-b+d**0.5)/(2*a) r2=(-b-d**0.5)/(2*a) write(*,*)"roots are real and values are =",r1,r2 else write(*,*)"roots are complex =" END IF stop end program for summing fifth integer IMPLICIT REAL (A-H,O-Z) write(*,*)'give first point=',x1,y1 read(*,*)x1,y1 write(*,*)'give second point=',x2,y2 read(*,*)x2,y2 write(*,*)'give third point=',x3,y3 read(*,*)x3,y3 slope1=(y2-y1)/(x2-x1) slope2=(y3-y2)/(x3-x2) IF(slope1 .EQ. slope2)THEN write(*,*)"three points are collinear" else write(*,*)"three points are not collinear" END IF stop end

11.
c

12.
c

25 35

program for rectangle area vs perimeter IMPLICIT REAL (A-H,O-Z) write(*,*)'give values four sides:' read(*,*)a,b,c,d peri=2*(a+b) area=a*b IF (area.gt.peri)then go to 25 else go to 35 END IF write(*,*)'area is greater than perimeter' write(*,*)'area is less than perimeter' stop end

You might also like