0% found this document useful (0 votes)
4 views1 page

!print, D 2, D 3

H

Uploaded by

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

!print, D 2, D 3

H

Uploaded by

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

1 Program Q1

2 implicit none
3 integer::i,j,d3=0,d2=0
4 integer,dimension(50,50):: A
5
6 open(20,file="Matrix_A_input.txt")
7 open(21,file="Matrix_A_output.txt")
8
9 do i=1,4
10 read(20,*)(A(i,j),j=1,4)
11 end do
12
13 write(21,*)
14 write(21,*)"Ans. to the Q. no.(a)"
15 write(21,*)"Matrix A in matrix form"
16 write(21,'(30("-"))')
17
18 do i=1,4
19 write(21,'(4i4,/,4i4,/,4i4,/,4i4)')(A(i,j),j=1,4)
20 end do
21
22 write(21,*)
23 write(21,*)"Ans. to the Q. no.(b)"
24 write(21,*)"All elements of in horizontal line"
25 write(21,'(40("-"))')
26
27 write(21,'(16i3)')((A(i,j),j=1,4),i=1,4)
28
29 write(21,*)
30 write(21,*)"Ans. to the Q. no.(c)"
31 write(21,*)"All elements of in Vertical line"
32 write(21,'(40("-"))')
33
34 do i=1,4
35 do j=1,4
36 write(21,*)A(i,j)
37 end do
38 end do
39
40 write(21,*)
41 write(21,*)"Ans. to the Q. no.(d)"
42 write(21,'(40("-"))')
43
44 write(21 ,'(i12,3i3)')(A(1,j),j=1,4)
45 do i=2,4
46 write(21,*)A(i,1)
47 end do
48
49 write(21,*)
50 write(21,*)"Ans. to the Q. no.(e)"
51 write(21,'(40("-"))')
52
53 do i=1,4
54 do j=1,4
55 if (i==j)then
56 d3=d3+(A(i,j)**3)
57 d2=d2+(A(4-j+1,j)**2)
58 end if
59 end do
60 end do
61 !print*,d2,d3
62 if(d3>d2)write(21,*)"Given statement is true"
63
64 write(21,*)
65 write(21,*)"Ans. to the Q. no.(f)"
66 write(21,'(40("-"))')
67
68 do i=1,4
69 write(21,'(4i4,/,4i4,/,4i4,/,4i4)')(A(j,i),j=1,4)
70 end do
71
72
73
74
75
76
77 End Program
78

You might also like