Sie sind auf Seite 1von 47

Sheet No: 1

Program No: 1
Aim: To print sum of natural numbers, sum of odd, sum of even, no of odd, no of even
from 1 to 10.
Analysis: An identifier runs from 1 to 10 and test each number is even or odd. If it is
even calculate sum of even and number of even else calculate sum of odd and number of
odd. At last add both sum of even and sum of odd we get sum of the natural numbers.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
,, N %I! -./0.
,, I %I! -./0.
,, $N %I! -./0 #A12E 0.
,, $E %I! -./0 #A12E 0.
,, $" %I! -./0 #A12E 0.
,, NE %I! -./0 #A12E 0.
,, N"D %I! -./0 #A12E 0.
,, & %I! -./0.
,, T %I! -./0.
%&"!ED2&E DI#I$I"N.
(%.
DI$%1A3 4ENTE& AN3 N2(5E& 64.
A!!E%T N.
%E&"&( E% #A&3IN' I &"( 1 53 1 2NTI1 I7N.
DI$%1A3 4$2( " E#EN N2(5E&$ 64, $E.
DI$%1A3 4$2( " "DD N2(5E&$64, $".
!"(%2TE $N 8 $E 9 $".
DI$%1A3 4$2( " T:E NAT2&A1 N2(5E&$ 64, $N.
DI$%1A3 4N2(5E& " E#EN N2(5E&$ 64, NE.
DI$%1A3 4N2(5E& " "DD N2(5E&$ 64, N"D.
$T"% &2N.
E%.
DI#IDE I 53 ; 'I#IN' T &E(AINDE& &.
I &80
!"(%2TE $E 8 $E 9 I
!"(%2TE NE 8 NE 9 1
E1$E
!"(%2TE $" 8 $" 9 I
!"(%2TE N"D 8 N"D 9 1.
Sheet No: 2
Output:
ENTE& AN3 N2(5E& 6
10
$2( " E#EN N2(5E&$6000<0
$2( " "DD N2(5E&$ 6000;/
$2( " T:E NAT2&A1 N2(5E&$ 6000//
N2(5E& " E#EN N2(5E&$60000/
N2(5E& " "DD N2(5E&$60000/
Conclusion:
irst accepting the integer N for range to calculate i.e., from 1 to N now
calculating the re=uired and the sum of even, odd and number of even, odd and the sum
of natural numbers are printed.
Sheet No: 3
Program No: 2
Aim: To print the big > smallest digit, sum of digits and number of digits in a given
number.
Analysis: Accept a number N. Divide the number with 10 then we get an individual digit
chec? the ever@ digit to get biggest and smallest digit in a given number and add each
digit to a sum identifier to get the sum of the digits and add 1 to a counter identifier to get
the number of digits. The =uotient is stored in the same identifier and repeat this process
until the identifier value becomes 0.
Source Code:

IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
,, N %I! -./0.
,, & %I! -./0.
,, I %I! --.
,, $ %I! -- #A12E -.
,, 5 %I! -- #A12E 0.
,, $2( %I! -- #A12E 0.
,, ND %I! -- #A12E 0.
%&"!ED2&E DI#I$I"N.
(%.
DI$%1A3 4ENTE& AN3 N2(5E& 64.
A!!E%T N.
%E&"&( D% #A&3IN' I &"( 1 53 1 2NTI1 N80.
DI$%1A3 45I''E$T DI'IT I$64, 5.
DI$%1A3 4N2(5E& " DI'IT$64, ND.
DI$%1A3 4$(A11E$T DI'IT I$64, $.
DI$%1A3 4$2( " T:E DI'IT$64, $2(.
$T"% &2N.
D%.
DI#IDE N 53 10 'I#IN' N &E(AINDE& &.
!"(%2TE $2( 8 $2( 9 &.
!"(%2TE ND 8 ND 9 1.
I 5A&
("#E & T" 5.
I $7&
("#E & T" $.
Sheet No: 4
Output:
ENTE& AN3 N2(5E&6
1;<
0000<
0000;
00001
5I''E$T DI'IT I$6 0<
$(A11E$T DI'IT I$6 01
N2(5E& " T:E DI'IT$6 0<
$2( " T:E DI'IT$6 0B
Conclusion:
irst accepting the integer and the calculation is done as mentioned above
and the biggest digit and smallest digits in the given integer are printed and the number of
digits, sum of the digits that are present in the given integer are printed after that.
Sheet No: 5
Program No: 3
Aim: Accept an@ integer chec? whether it is a %A1IND&"(E number or not.
Analysis: Accept the natural number N. (ove N to another identifier C. Divide the
number N with 10 then we get the individual digit. (ultipl@ it b@ 10 and add it to an
identifier $ and the process is continued until N becomes 0. inall@ comparing $ and C
we can confirm it is %alindrome or not.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
,, N %I! -./0.
,, C %I! -./0.
,, $ %I! -./0 #A12E 0.
,, & %I! -./0.
%&"!ED2&E DI#I$I"N.
%A&A)A.
DI$%1A3 4ENTE& T:E N2(5E& 64.
A!!E%T N.
("#E N T" C.
%E&"&( %A&A)5 2NTI1 N80.
I C8$
DI$%1A3 4N2(5E& I$ %A11IND&"(E.4
E1$E
DI$%1A3 4N2(5E& I$ N"T %A11IND&"(E.4.
$T"% &2N.
%A&A)5.
DI#IDE N 53 10 'I#IN' N &E(AINDE& &.
!"(%2TE $ 8 $ D 10 9 &.
Output:
ENTE& T:E N2(5E& 6
1;1
N2(5E& I$ %A11IND&"(E.
Conclusion:
Accepting an integer and calculated as mentioned above. After process is
completed comparing $ and C the result is printed as given number is %alindrome.
Sheet No: 6
Program No: 4
Aim: Accept a number and chec? whether it is A($T&"N' number or not.
Analysis: Accept the natural number N. (ove N to another identifier C. Divide the
number with 10 then we get the individual digit and calculate its cube and add it to an
identifier $ and the process is continued until N becomes 0. inall@ comparing $ and C
we can confirm it is Armstrong or not.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
EN#I&"N(ENT DI#I$I"N.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
,, N %I! -.<0.
,, & %I! -.<0.
,, C %I! -.<0 #A12E 1.
,, $ %I! -.<0 #A12E 0.
%&"!ED2&E DI#I$I"N.
%A&A)A.
DI$%1A3 4ENTE& T:E #A12E "& N6 4.
A!!E%T N.
("#E N T" C.
%E&"&( %A&A)5 2NTI1 N80.
DI$%1A3 4$ I$ 64, $.
I C8$
DI$%1A3 4N I$ A($T&"N' N".4
E1$E
DI$%1A3 4N I$ N"T A A($T&"N' N".4.
$T"% &2N.
%A&A)5.
DI#IDE N 53 10 'I#IN' N &E(AINDE& &.
!"(%2TE & 8 & D & D &.
!"(%2TE $ 8 $ 9 &.
Output:
ENTE& T:E #A12E "& N6
1/<
$ I$ 61/<
N I$ A($T&"N' N".
Conclusion:
Accepting an integer calculated as mentioned above. After process is
completed comparing $ and C result is printed as the given number is Armstrong.
Sheet No:
Program No: 5
Aim: Accept a number and chec? whether it is a %&I(E number or not.
Analysis: Accept an@ integer N. Divide N with ever@ integer from ; to N)1 and chec? the
remainder at ever@ step is 0 or not. If it is 0 then move 1 to an identifier flag. !hec? the
identifier flag if e=ual to 1 then the given number is not prime.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
,, N %I! --.
,, I %I! -- #A12E ;.
,, T %I! --.
,, & %I! --.
,, 1A' %I! - #A12E 0.
%&"!ED2&E DI#I$I"N.
(%.
DI$%1A3 4ENTE& T:E #A12E 64.
A!!E%T N.
%E&"&( %&I(E #A&3IN' I &"( ; 53 1 2NTI1 I8N.
I 1A'81
DI$%1A3 4'I#EN N2(5E& I$ N"T %&I(E.4
E1$E
DI$%1A3 4'I#EN N2(5E& I$ %&I(E.4.
$T"% &2N.
%&I(E.
DI#IDE N 53 I 'I#IN' T &E(AINDE& &.
I &80
("#E 1 T" 1A'.

Output:
ENTE& T:E #A12E 6
11
'I#EN N2(5E& I$ %&I(E.
Conclusion:
Accepting an integer N and calculated as eEplained above. After completion
of the process chec?ing the flag identifier is 0 the result is printed that the given integer is
prime.
Sheet No: !
Program No: 6
Aim: Accept a number and chec? whether it is a %E&E!T number or not.
Analysis: Accept the natural number N. (ove N to another identifier C. Divide the
number from 1 to N)1 and chec? the remainder if it is 0 or not i.e., whether it is a factor
or not if @es then add it to an identifier $ which is initialiFed to 0. inall@ compare $ and
C.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
EN#I&"N(ENT DI#I$I"N.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
,, N %I! -.<0.
,, & %I! -.<0.
,, T %I! -.<0 #A12E 1.
,, I %I! -.<0.
,, C %I! -.<0 #A12E 1.
,, $ %I! -.<0 #A12E 0.
%&"!ED2&E DI#I$I"N.
%A&A)A.
DI$%1A3 4ENTE& T:E #A12E "& N6 4.
A!!E%T N.
("#E N T" C.
%E&"&( %A&A)5 #A&3IN' I &"( 1 53 1 2NTI1 I8N.
I C8$
DI$%1A3 4N I$ %E&E!T N".4
E1$E
DI$%1A3 4N I$ N"T A %E&E!T N".4.
$T"% &2N.
%A&A)5.
DI#IDE N 53 I 'I#IN' T &E(AINDE& &.
I &80
!"(%2TE $ 8 $ 9 I.
Output:
ENTE& T:E #A12E "& N6 B
N I$ %E&E!T N".
Conclusion:
Accepting an integer calculated as mentioned above. After the process is
completed $ and C are compared and the result is printed as the given number N is
%E&E!T.
Sheet No: "
Program No:
Aim: Accept a number and chec? whether it is a $T&"N' number or not.
Analysis: Accept the natural number N. (ove N to another identifier C. Divide the
number with 10 to get the remainder digit, find the factorial of the digit and add it to an
identifier $ which is initialiFed to 0 continue the process until N is e=ual to 0 and finall@
compare $ and C.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
EN#I&"N(ENT DI#I$I"N.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
,, N %I! -.<0.
,, & %I! -.<0.
,, %I! -.<0 #A12E 1.
,, C %I! -.<0 #A12E 1.
,, $ %I! -.<0 #A12E 0.
%&"!ED2&E DI#I$I"N.
%A&A)A.
DI$%1A3 4ENTE& T:E N2(5E&6 4.
A!!E%T N.
("#E N T" C.
%E&"&( %A&A)5 2NTI1 N80.
I C8$
DI$%1A3 4N I$ $T&"N' N2(5E&.4
E1$E
DI$%1A3 4N I$ N"T A $T&"N' N2(5E&.4.
$T"% &2N.
%A&A)5.
DI#IDE N 53 10 'I#IN' N &E(AINDE& &.
%E&"&( %A&A) 2NTI1 &81.
!"(%2TE $ 8 $ 9 .
("#E 1 T" .
%A&A).
!"(%2TE 8 D &.
!"(%2TE & 8 & ) 1.
Sheet No: 1#
Output:
ENTE& T:E N2(5E&6 1G/
N I$ $T&"N' N2(5E&.
Conclusion:
Accepting an integer calculation is done as mentioned above. After the
process is completed $ and C are compared and the result is displa@ed as the given
number N is $T&"N'.
Sheet No: 11
Program No: !
Aim: Accept the number of terms in the series and displa@ the ibonacci series.
Analysis: Ta?e two identifiers a, b and initialiFe them to 0 and 1 and displa@ them. Ta?e
another identifier c and store the sum of a, b and displa@ c and then swap the three
identifiers b to a and c to b and repeat the sum of c8a9b and displa@ c until the series
comes to the end i.e., the given number of terms comes.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
,, A %I! --- #A12E 0.
,, 5 %I! --- #A12E 1.
,, ! %I! --- #A12E 0.
,, I %I! --.
,, N %I! --.
%&"!ED2&E DI#I$I"N.
(%.
DI$%1A3 4ENTE& T:E N2(5E& " I5"NA!!I TE&($64.
A!!E%T N.
DI$%1A3 4T:E I5"NA!!I $I&E$64.
DI$%1A3 . , 0 A 4 4.
DI$%1A3 . , 0 5 4 4.
%E&"&( % #A&3IN' I &"( < 53 1 2NTI1 I7N.
$T"% &2N.
%.
!"(%2TE ! 8 A 9 5.
DI$%1A3 ., 0 ! 4 4.
("#E 5 T" A.
("#E ! T" 5.
Output:
ENTE& T:E N2(5E& " I5"NA!!I TE&($. 6
10
T:E I5"NA!!I $I&E$6
00 01 01 0; 0< 0/ 0H 1< ;1 <G
Conclusion:
Accept the number of terms N of ibonacci series. Displa@ the first two
terms and then starting from < until I is greater than N repeat the given process and
finall@ the series is displa@ed upto the given number of terms.
Sheet No: 12
Program No: "
Aim: Accept the number and displa@ the factorial of the number.
Analysis: Accept a number N. InitialiFe an identifier to 1 multipl@ the identifier with N
and decrementing the N b@ 1 and again multipl@ing to f and continue the process until N
is greater than 0. inall@ the result is stored in the identifier and displa@ it.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
EN#I&"N(ENT DI#I$I"N.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
,, N %I! -.;0.
,, %I! -.G0 #A12E 1.
%&"!ED2&E DI#I$I"N.
%A&AA.
DI$%1A3 4ENTE& T:E #A12E "& N6 4.
A!!E%T N.
%E&"&( %A&A5 2NTI1 N 7 0.
DI$%1A3 4A!T"&IA1 " A 'I#EN N2(5E& 64, .
$T"% &2N.
%A&A5.
!"(%2TE 8 N D .
!"(%2TE N 8 N ) 1.

Output:
ENTE& T:E #A12E "& N6
/
A!T"&IA1 " A 'I#EN N2(5E&6 01;0
Conclusion:
Accept an@ integer to which the factorial is to be found. %rocess is done as
given and the final result is displa@ed.
Sheet No: 13
Program No: 1#
Aim: To print ;0 mathematical tables from 1 to ;0.
Analysis: !onsider three identifiers I,I and N. &un the identifiers I and I from 1 to ;0
one after the other and multipl@ them and result is stored in N. Displa@ them interactivel@
and stop the eEecution for each table i.e., when I reaches to ;0.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
,, I %I! --.
,, N %I! --.
,, I %I! --.
%&"!ED2&E DI#I$I"N.
(%.
%E&"&( (T #A&3IN' I &"( 1 53 1 2NTI1 I 7 ;0
ATE& I &"( 1 53 1 2NTI1 I 7 ;0.
$T"% &2N.
(T.
!"(%2TE N 8 I D I.
DI$%1A3 I 4D4, I 484, N.
I I 8 ;0
$T"% 4%&E$$ AN3 +E3 T" !"NTIN2E...4.
Output:
1 D 1 8 1
1 D ; 8 ;
...
...
1 D ;0 8 ;0
%&E$$ AN3 +E3 T" !"NTIN2EJ
; D 1 8 ;
; D ; 8 G
J
J
J
;0 D 1 8 ;0
;0 D ; 8 G0
J
J
%&E$$ AN3 +E3 T" !"NTIN2EJ
Conclusion: ollowing the given process the output is displa@ed as shown above and the
eEecution stops temporaril@ for each and ever@ table and continues b@ pressing an@ ?e@
on the ?e@ board.
Sheet No: 14
Program No: 11
Aim: To print student mar?s statement using filler clause.
Analysis: !reate a group of items for each line in the statement. To calculate, ta?e
individual identifiers in addition. !alculate and move the result to the identifier in a
group.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
01 51.
0; %I! C.,-0 #A12E $%A!E.
01 1I.
0; %I! C.,-0 #A12E A11 4)4.
01 :1)&E!.
0; %I! C.100 #A12E $%A!E.
0; %I! C.1/0 #A12E 4$&+$IT 1I(ITED.4.
01 :;)&E!.
0; %I! C.100 #A12E $%A!E.
0; %I! C.110 #A12E 4#IIA3A*ADA.4.
01 :<)&E!.
0; %I! C.100 #A12E $%A!E.
0; %I! C.;G0 #A12E 4$T2DENT (A&+$ $TATE(ENT.4.
01 :G)&E!.
0; %I! C./0 #A12E $%A!E.
0; %I! C.110 #A12E 4$T2DENT N"64.
0; $N" %I! -----.
0; %I! C./0 #A12E $%A!E.
0; %I! C.G0 #A12E 4NA(E4.
0; NA(E %I! A.100.
01 :/)&E!.
0; %I! C./0 #A12E $%A!E.
0; %I! C.B0 #A12E 4!"5"164.
0; !"5 %I! --.
0; %I! C./0 #A12E $%A!E.
0; %I! C.;0 #A12E 4!64.
0; ! %I! --.
0; %I! C./0 #A12E $%A!E.
0; %I! C.G0 #A12E 4!%%64.
0; !%% %I! --.
01 :B)&E!.
0; %I! C./0 #A12E $%A!E.
Sheet No: 15
0; %I! C.B0 #A12E 4T"TA164.
0; T"T %I! ---.
0; %I! C./0 #A12E $%A!E.
0; %I! C.G0 #A12E 4A#'64.
0; A#' %I! ---#--.
01 :,)&E!.
0; %I! C./0 #A12E $%A!E.
0; %I! C.,0 #A12E 4&E$21T64.
0; &E$ %I! A./0.
0; %I! C./0 #A12E $%A!E.
0; %I! C.-0 #A12E 4DI#I$I"N64.
0; DI# %I! C./0.
%&"!ED2&E DI#I$I"N.
(%.
DI$%1A3 4ENTE& T:E $T2DENT N2(5E&6 4.
A!!E%T $N".
DI$%1A3 4ENTE& T:E $T2DENT NA(E 64.
A!!E%T NA(E.
DI$%1A3 4ENTE& T:E (A&+$ IN !"5"1,!>!%% 64.
A!!E%T !"5.
A!!E%T !.
A!!E%T !%%.
!"(%2TE T"T 8 !"5 9 ! 9 !%%.
!"(%2TE A#' 8 T"T K <.
I !"57/0 AND !7/0 AND !%%7/0
%E&"&( D%
E1$E
("#E 4AI14 T" &E$
("#E 4NI114 T" DI#.
DI$%1A3 .1, 10E&A$E.
DI$%1A3 :1)&E!.
DI$%1A3 :;)&E!.
DI$%1A3 :<)&E!.
DI$%1A3 1I.
DI$%1A3 :G)&E!.
DI$%1A3 1I.
DI$%1A3 :/)&E!.
DI$%1A3 1I.
DI$%1A3 :B)&E!.
DI$%1A3 1I.
DI$%1A3 :,)&E!.
$T"% &2N.
D%.
("#E 4%A$$4 T" &E$.
Sheet No: 16
I A#'7,/
("#E 4DI$TI'2I$:4 T" DI#
E1$E I A#' 7B0
("#E 4I$T4 T" DI#
E1$E
("#E 4IIND4 T" DI#.
Output:
ENTE& T:E $T2DENT N2(5E&6
11
ENTE& T:E $T2DENT NA(E6
&A':2
ENTE& T:E (A&+$ IN !"5"1, ! > !%%6
G0
G0
G0
$&+ 1I(ITED.
#IIA3A*ADA.
$T2DENT (A&+$ $TAE(ENT.
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
$T2DENT N"6 11 $T2DENT NA(E6 &A':2
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
!"5"16 H0 !6 H0 !%%6 H0
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
T"TA16 ;G0 A#A&A'E6 H0.00
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
&E$21T6 %A$$ DI#I$I"N6 DI$TINTI"N.
Conclusion:
Accept no, name, mar?s and calculate the total and average store to the
identifiers in the group. And displa@ the record using the group name as in the statement.
Sheet No: 1
Program No: 12
Aim: To print a power bill statement using the filler clause.
Analysis: !reate a group of items for each line in the statement. To calculate, ta?e
individual identifiers in addition. !alculate and move the result to the identifier in a
group.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
01 51.
0; %I! C.,-0 #A12E $%A!E.
01 1I.
0; %I! C.,-0 #A12E A11 4)4.
01 :1)&E!.
0; %I! C.100 #A12E $%A!E.
0; %I! C.100 #A12E 4A%$E 5"A&D4.
01 :;)&E!.
0; %I! C.100 #A12E $%A!E.
0; %I! C.110 #A12E 4#IIA3A*ADA.4.
01 :<)&E!.
0; %I! C.100 #A12E $%A!E.
0; %I! C.100 #A12E 4%"*E& 5I114.
01 :G)&E!.
0; %I! C./0 #A12E $%A!E.
0; %I! C.110 #A12E 4$E&#I!E N"64.
0; $N" %I! -----.
0; %I! C./0 #A12E $%A!E.
0; %I! C.1<0 #A12E 4!2$T"(E& NA(E4.
0; !NA(E %I! A.100.
01 :/)&E!.
0; %I! C.<0 #A12E $%A!E.
0; %I! C.<0 #A12E 41(&4.
0; 1(& %I! -----.
0; %I! C.<0 #A12E $%A!E.
0; %I! C.G0 #A12E 4!(&64.
0; !(& %I! -----.
0; %I! C.<0 #A12E $%A!E.
0; %I! C./0 #A12E 4!"DE64.
0; !"DE %I! A.
0; %I! C.<0 #A12E $%A!E.
0; %I! C./0 #A12E 4!"$T64.
Sheet No: 1!
0; !"$ %I! -----.--.
0; %I! C.<0 #A12E $%A!E.
0; %I! C.B0 #A12E 42NIT$64.
0; 2NI %I! -----#--.
,, !"$T %I! -----#--.
01 :B)&E!.
0; %I! C./0 #A12E $%A!E.
0; %I! C.1G0 #A12E 45I11 A("2NT 64.
0; 5I11 %I! -----.--.
,, A(T %I! -----#--.
%&"!ED2&E DI#I$I"N.
(%.
DI$%1A3 4ENTE& T:E $E&#I!E N"6 4.
A!!E%T $N".
DI$%1A3 4ENTE& T:E !2$T"(E& NA(E 64.
A!!E%T !NA(E.
DI$%1A3 4ENTE& !"DE64.
A!!E%T !"DE.
DI$%1A3 4ENTE& 1(&64.
A!!E%T 1(&.
DI$%1A3 4ENTE& !(&64.
A!!E%T !(&.
!"(%2TE 2NI 8 !(& ) 1(&.
I !"DE84D4
("#E ;./0 T" !"$T
E1$E I !"DE8454
("#E <.0/ T" !"$T
E1$E I !"DE84I4
("#E /.00 T" !"$T.
!"(%2TE A(T 8 !"$T D 2NI.
("#E !"$T T" !"$.
("#E A(T T" 5I11.
DI$%1A3 .1, 10E&A$E.
DI$%1A3 :1)&E!.
DI$%1A3 :;)&E!.
DI$%1A3 :<)&E!.
DI$%1A3 1I.
DI$%1A3 :G)&E!.
DI$%1A3 1I.
DI$%1A3 :/)&E!.
DI$%1A3 1I.
DI$%1A3 :B)&E!.
DI$%1A3 1I.
$T"% &2N.
Sheet No: 1"
Output:
ENTE& T:E $E&#I!E N2(5E& 6
11
ENTE& T:E !2$T"(E& NA(E6
&A':2
ENTE& !"DE 6
5
ENTE& 1(& 6
100
ENTE& !(& 6
;00
A%$E 5"A&D.
#IIA3A*ADA.
%"*E& 5I11.
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
$E&#I!E N"6 11 !2$T("E& NA(E6 &A':2
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
1(& 6 100 !(& 6 ;00 !"DE 6 5 !"$T 6 0<.00 2NIT$ 6 000100
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
T"TA1 5I11 A("2NT 6 00<00.00
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
Conclusion:
Accept no, name, code, lmr, cmr and calculate the cost and units. !alculate
the bill amount using cost and units. $tore the result in identifier in the group and displa@
the record using the group name as in the statement.
Sheet No: 2#
Program No: 13
Aim: To create a table of 10 cells input values in it > print the biggest > smallest values
in it. And sort the elements.
Analysis: !reate an arra@ of siFe 10 and compare each element with 0 and if the element
is greater than 0 then swap the elements. To obtain the smallest element compare each
element with - and obtain the smallest elements. $ort the arra@ compare the element with
other elements and place the smallest element in lower position b@ swaping the elements
and the first element is small and last element is biggest element in the arra@.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
01 A&&.
0; A %I! -.;0 "!!2&$ 10 TI(E$.
,, I %I! -.;0.
,, I %I! --.
,, 5 %I! -.;0 #A12E 0.
,, $ %I! -.;0 #A12E 0.
,, T %I! --.
%&"!ED2&E DI#I$I"N.
%A&A)A.
DI$%1A3 4ENTE& T:E A&&A3 E1E(ENT$ 64.
%E&"&( A% #A&3IN' I &"( 1 53 1 2NTI1 I710.
%E&"&( $% #A&3IN' I &"( 1 53 1 2NTI1 I710
ATE& I &"( 1 53 1 2NTI1 I710.
DI$%1A3 4T:E $"&TED A&&A3 64.
%E&"&( D% #A&3IN' I &"( 1 53 1 2NTI1 I710.
DI$%1A3 45I''E$T E1E(ENT I$ 64, A.100.
DI$%1A3 4$(A11E$T E1E(ENT I$ 64, A.10.
$T"% &2N.
A%.
A!!E%T A.I0.
$%.
I A.I0AA.I0
("#E A.I0 T" T
("#E A.I0 T" A.I0
("#E T T" A.I0.
D%.
DI$%1A3 ., 0A.I0 4 4.
Sheet No: 21
Output:
ENTE& T:E A&&A3 E1E(ENT$6
//
;;
GG
--
HH
,,
<<
11
BB
1/
T:E $"&TED A&&A36
11 1/ ;; << GG // BB ,, HH --
5I''E$T E1E(ENT I$6 --
$(A11E$T E1E(ENT I$611
Conclusion:
Accept the arra@ elements. !ompare one element with remaining elements
and if smallest occurs then swap both elements and print the elements after swap. To get
the biggest print the last element of the arra@. To get the smallest element print the first
element of the arra@.
Sheet No: 22
Program No: 14
Aim: Accept the values in the arra@ and perform the linear search > binar@ search.
Analysis: Accept the elements into an arra@ and then accept the element to be searched in
the arra@ and then search for it using the linear search and binar@ search. In the linear
search each and ever@ element is compared with the ?e@ element and then if matches an@
where a flag variable is given the value 1 and then finall@ if the flag value is 1 the
element is found else not found. In the binar@ search the elements are sorted and the ?e@
element is compared with the mid element and if the element matches then o? else if the
?e@ element is greater .smaller0 than the mid element then the arra@ is divided into two
halves and search process continues in the same wa@ in the second .first0 half for the
element finall@ the result is displa@ed.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
01 A&&.
0; A %I! -.;0 "!!2&$ / TI(E$.
,, I %I! -.;0.
,, I %I! --.
,, + %I! -.;0.
,, TE(% %I! --.
,, T %I! -- #A12E /.
,, 5 %I! -- #A12E 1.
,, ( %I! -- #A12E <.
,, N %I! --.
,, %I! -- #A12E 0.
%&"!ED2&E DI#I$I"N.
%A&A)A.
DI$%1A3 41INEA& $EA&!: 4.
DI$%1A3 4ENTE& T:E A&&A3 E1E(ENT$ 64.
%E&"&( A% #A&3IN' I &"( 1 53 1 2NTI1 I7/.
DI$%1A3 4ENTE& T:E E1E(ENT T" 5E "2ND4.
A!!E%T +.
%E&"&( 1$ #A&3IN' I &"( 1 53 1 2NTI1 I7/.
I 80
DI$%1A3 4T:E E1E(ENT I$ N"T "2ND4
E1$E
DI$%1A3 4E1E(ENT "2ND4.
DI$%1A3 45INA&3 $EA&!: 4.
DI$%1A3 4ENTE& T:E E1E(ENT T" 5E "2ND IN T:E $A(E A&&A34.
A!!E%T N.
Sheet No: 23
%E&"&( T% #A&3IN' I &"( 1 53 1 2NTI1 I 7 /
ATE& I &"( 1 53 1 2NTI1 I 7 G.
DI$%1A3 4E1E(ENT$ ATE& $"&TIN' IN T:E A&&A3 A&E64.
%E&"&( D% #A&3IN' I &"( 1 53 1 2NTI1 I 7 /.
%E&"&( 5$ 2NTI1 5 7 T "& A.(0 8 N.
I A.(0 8 N
DI$%1A3 4E1(ENT I$ "2ND4
E1$E
DI$%1A3 4E1(ENT I$ N"T "2ND4.
$T"% &2N.
A%.
A!!E%T A.I0.
T%.
!"(%2TE + 8 I 9 1.
I A.I0 7 A.+0
("#E A.I0 T" TE(%
("#E A.+0 T" A.I0
("#E TE(% T" A.+0.
5$.
!"(%2TE ( 8 .T 9 50 K ;.
I N 7 A.(0
!"(%2TE 5 8 ( 9 1
E1$E I N A A.(0
!"(%2TE T 8 ( ) 1.
1$.
I +8A.I0
DI$%1A3 4T:E E1E(ENT I$ "2ND.4
("#E 1 T" .
D%.
DI$%1A3 . , 0 A.I0 4 4.
Out Put:
1INEA& $EA&!:
ENTE& T:E A&&A3 E1E(ENT$ 6
1/
,/
-<
1G
<;
HB
GG
<H
-1
/G
Sheet No: 24
ENTE& T:E E1E(ENT T" 5E "2ND
/B
E1E(ENT I$ N"T "2ND
5INA&3 $EA&!:
ENTE& T:E E1E(ENT T" 5E "2ND IN T:E $A(E A&&A3
1G
E1E(ENT$ ATE& $"&TIN' IN T:E A&&A3 A&E6
1G 1/ <; <H GG /G ,/ HB -1 -<
E1E(ENT I$ "2ND
Conclusion:
Accepting the elements into the arra@ the element to be found are also
accepted in the linear and binar@ search techni=ues the@ are verified and the results are
displa@ed.
Sheet No: 25
Program No: 15
Aim: 1inear search using IndeEed table.
Analysis: !reate the arra@ which is indeEed with I. To search the element in indeEed
table use the reserved word $EA&!:. 5efore start the search process set the value of I to
1.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
01 A&&.
0; A %I! -- "!!2&$ / TI(E$ INDECED 53 I.
,, + %I! --.
%&"!ED2&E DI#I$I"N.
(%.
DI$%1A3 4ENTE& T:E E1E(ENT$ 64.
%E&"&( A% #A&3IN' I &"( 1 53 1 2NTI1 I7/.
DI$%1A3 4ENTE& T:E E1E(ENT T" 5E $EA&!:ED64.
A!!E%T +.
$ET I T" 1.
$EA&!: A AT END DI$%1A3 4E1E(ENT N"T "2ND4 *:EN +8A.I0
DI$%1A3 4E1E(ENT "2ND.4.
$T"% &2N.
A%.
A!!E%T A.I0.
Output:
ENTE& T:E E1E(ENT$ 6
-
G
H
,
B
ENTE& T:E E1E(ENT T" 5E $EA&!:ED6
G
E1E(ENT "2ND.
Conclusion:
Accept the elements in the arra@ and after the element to be searched is
entered using the $EA&!: reserved word and in that statement the element is found or
not are included and through the internal process the result is displa@ed as element is
found.
Sheet No: 26
Program No: 16
Aim: 5inar@ search using IndeEed table.
Analysis: !reate the arra@ which is indeEed with I. To search the element in indeEed
table uses the reserved word $EA&!: A11. 5efore start the search process set the value
of I to 1.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
01 A&&.
0; A %I! -- "!!2&$ / TI(E$ A$!ENDIN' +E3 I$ + INDECED 53 I.
,, + %I! --.
%&"!ED2&E DI#I$I"N.
(%.
DI$%1A3 4ENTE& T:E E1E(ENT$64.
%E&"&( A% #A&3IN' I &"( 1 53 1 2NTI1 I7/.
DI$%1A3 4ENTE& T:E +E364.
A!!E%T +.
$ET I T" 1.
$EA&!: A11 A AT END DI$%1A3 4E1E(ENT N"T "2ND4 *:EN
+8A.I0 DI$%1A3 4E1E(ENT "2ND.4.
$T"% &2N.
A%.
A!!E%T A.I0.
Output:
ENTE& T:E E1E(ENT$6
/
,
B
;
-
ENTE& T:E +E36
B
E1E(ENT "2ND.
Conclusion:
Accept the elements in arra@ and after the element to be found is entered
using the $EA&!: A11 reserved word and in that statement, the element is found or not
is included and the final result is displa@ed as the element is found.
Sheet No: 2
Program No: 1
Aim: Addition of two matrices.
Analysis: !reate three matrices for entering the elements two and to store the addition of
those two the other. Add the elements in the same position and store the result in the
same position in the third matriE.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
01 A&&.
0; AA "!!2&$ ; TI(E$.
0< A %I! -- "!!2&$ ; TI(E$.
0< 5 %I! -- "!!2&$ ; TI(E$.
0< ! %I! -- "!!2&$ ; TI(E$.
,, I %I! -.
,, I %I! -.
,, + %I! -.
,, T %I! -- #A12E 0.
%&"!ED2&E DI#I$I"N.
(%.
DI$%1A3 4ENTE& T:E I&$T (AT&IC E1E(ENT$64.
%E&"&( A% #A&3IN' I &"( 1 53 1 2NTI1 I7;
ATE& I &"( 1 53 1 2NTI1 I7;.
DI$%1A3 4ENTE& T:E $E!"ND (AT&IC E1E(ENT$64.
%E&"&( 5% #A&3IN' I &"( 1 53 1 2NTI1 I7;
ATE& I &"( 1 53 1 2NTI1 I7;.
DI$%1A3 .1, 10 E&A$E.
DI$%1A3 .1, /0 4I&$T4.
DI$%1A3 .;, /0 4))))))4.
DI$%1A3 .1, 1H0 4$E!"ND4.
DI$%1A3 .;, 1H0 4))))))))4.
DI$%1A3 .1, <004(AT&IC ADDITI"N.4
DI$%1A3 .;, <004)))))))))))))))))))))))))4.
%E&"&( AD% #A&3IN' I &"( 1 53 1 2NTI1 I7;
ATE& I &"( 1 53 1 2NTI1 I7;.
$T"% &2N.
A%.
A!!E%T A.I, I0.
5%.
A!!E%T 5.I, I0.
Sheet No: 2!
("#E 0 T" !.I, I0.
AD%.
!"(%2TE 1IN 8 I D ; 9 1.
!"(%2TE !"1 8 I D < 9 ;.
DI$%1A3 .1IN, !"10A.I, I0.
!"(%2TE !"1 8 I D < 9 1/.
DI$%1A3 .1IN, !"105.I, I0.
!"(%2TE !.I, I0 8 A.I, I0 9 5.I, I0.
!"(%2TE !"1 8 I D < 9 <0.
DI$%1A3 .1IN, !"10!.I, I0.
("#E 0 T" !.I, I0.
Out Put:
ENTE& T:E I&$T (AT&IC E1E(ENT$6
1
;
<
G
ENTE& T:E $E!"ND (AT&IC E1E(ENT$6
/
B
,
H
I&$T $E!"ND (AT&IC ADDITI"N6
)))))))))))) ))))))))))))) )))))))))))))))))))))))))))))
1 0; 0/ 0B 0B 0H
0< 0G 0, 0H 10 1;
Conclusion:
Accept the first matriE and second matrices elements and the addition is
performed and the output is shown as the first, second and the result matriE are printed.
Sheet No: 2"
Program No: 1!
Aim: (ultiplication of two matrices.
Analysis: !reate three matrices for entering the elements two and to store the
multiplication of those two the other. (ultipl@ the elements in the first and second
matrices following the matriE multiplication rules i.e., multipl@ing the rows of the first
matriE to the columns of the second one and summing them. or this the number of
columns in the firs matriE must be e=ual to the number of rows in the second one.
Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
DATA DI#I$I"N.
*"&+IN')$T"&A'E $E!TI"N.
01 A&&.
0; AA "!!2&$ ; TI(E$.
0< A %I! -- "!!2&$ ; TI(E$.
0< 5 %I! -- "!!2&$ ; TI(E$.
0< ! %I! -- "!!2&$ ; TI(E$.
,, I %I! -.
,, I %I! -.
,, + %I! -.
%&"!ED2&E DI#I$I"N.
(%.
DI$%1A3 4ENTE& T:E I&$T (AT&IC E1E(ENT$64.
%E&"&( A% #A&3IN' I &"( 1 53 1 2NTI1 I7;
ATE& I &"( 1 53 1 2NTI1 I7;.
DI$%1A3 4ENTE& T:E $E!"ND (AT&IC E1E(ENT$64.
%E&"&( 5% #A&3IN' I &"( 1 53 1 2NTI1 I7;
ATE& I &"( 1 53 1 2NTI1 I7;.
DI$%1A3 .1, 10 E&A$E.
DI$%1A3 .1, /0 4I&$T4.
DI$%1A3 .;, /0 4))))))4.
DI$%1A3 .1, 1H0 4$E!"ND4.
DI$%1A3 .;, 1H0 4))))))))4.
DI$%1A3 .1, <004(AT&IC (21TI%1I!ATI"N64.
DI$%1A3 .;, ;-04)))))))))))))))))))))))4.
%E&"&( (21% #A&3IN' I &"( 1 53 1 2NTI1 I7;
ATE& I &"( 1 53 1 2NTI1 I7;
ATE& + &"( 1 53 1 2NTI1 +7;.
%E&"&( AD% #A&3IN' I &"( 1 53 1 2NTI1 I7;
ATE& I &"( 1 53 1 2NTI1 I7;.
$T"% &2N.
A%.
Sheet No: 3#
A!!E%T A.I, I0.
5%.
A!!E%T 5.I, I0.
("#E 0 T" !.I, I0.
AD%.
!"(%2TE 1IN 8 I D ; 9 1.
!"(%2TE !"1 8 I D < 9 ;.
DI$%1A3 .1IN, !"10A.I, I0.
!"(%2TE !"1 8 I D < 9 1/.
DI$%1A3 .1IN, !"105.I, I0.
!"(%2TE !"1 8 I D < 9 <0.
DI$%1A3 .1IN, !"10!.I, I0.
(21%.
!"(%2TE !.I, I0 8 !.I, I0 9 A.I, +0 D 5.+, I0.

Output:
ENTE& T:E I&$T (AT&IC E1E(ENT$6
1
;
<
G
ENTE& T:E $E!"ND (AT&IC E1E(ENT$6
/
B
,
H
I&$T $E!"ND (AT&IC (21TI%1I!ATI"N6
)))))))))))) ))))))))))))) ))))))))))))))))))))))))))))))))))))))))
1 0; 0/ 0B 1- ;;
0< 0G 0, 0H G< /0
Conclusion:
The elements are accepted in the two matrices simultaneousl@ at the same
time. The multiplication is done using another inner loop following the matriE
multiplication rules and last the three matrices are printed.
Sheet No: 31
Program No: 1"
Aim: %rogram to store the product details in a file named ITE(.DAT.
Analysis: In this program we can create a file b@ the !"5"1 program to write into the
file. *e have to name the file and records of the file and later during the eEecution i.e.,
during the runtime we can enter the records into the file through the ?e@board and can
store in the file. 5ut we can displa@ the contents of the file b@ another program.

Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
EN#I&"N(ENT DI#I$I"N.
IN%2T)"2T%2T $E!TI"N.
I1E)!"NT&"1
$E1E!T ITE()I1E A$$I'N T" DI$+ "&'ANILATI"N I$ $EM2ENTIA1.
DATA DI#I$I"N.
I1E $E!TI"N.
D ITE()I1E
1A5E1 &E!"&D$ A&E $TANDA&D #A12E " I1E)ID I$ 4ITE(.DAT4
DATA &E!"&D I$ ITE()&E!.
01 ITE()&E!.
0; I!"DE %I! -.G0.
0; INA(E %I! C.100.
0; IMT3 %I! -.G0.
0; I&ATE %I! -./0#--.
*"&+IN')$T"&A'E $E!TI"N.
%&"!ED2&E DI#I$I"N.
(AIN)%A&A.
"%EN "2T%2T ITE()I1E.
%E&"&( %A&A)1 / TI(E$.
!1"$E ITE()I1E.
$T"% &2N.
%A&A)1.
DI$%1A3 .1 , 10 E&A$E.
DI$%1A3 .- , 1/0 4ENTE& T:E ITE( !"DE64.
A!!E%T .- , G/0 I!"DE *IT: %&"(%T.
DI$%1A3 .11 , 1/0 4ENTE& T:E ITE( NA(E64.
A!!E%T .11 , G/0 INA(E *IT: %&"(%T.
DI$%1A3 .1< , 1/0 4ENTE& T:E ITE( M2ANTIT364.
A!!E%T .1< , G/0 IMT3 *IT: %&"(%T.
DI$%1A3 .1/ , 1/0 4ENTE& T:E ITE( &ATE64.
A!!E%T .1/ , G/0 I&ATE *IT: %&"(%T.
*&ITE ITE()&E!.
Sheet No: 32
Output:
ENTE& T:E ITE( !"DE6 NNG/
ENTE& T:E ITE( NA(E6 cosmetics
ENTE& T:E ITE( M2ANTIT36 NN10
ENTE& T:E ITE( &ATE6 NNN</./0
JJJJJJJJJJJJJJJJJJ
JJJJJJJJJJJJJJJJJJ
JJJJJJJJJJJJJJJJJJ
ENTE& T:E ITE( !"DE6 N1G;
ENTE& T:E ITE( NA(E6 homeneeds
ENTE& T:E ITE( M2ANTIT36 NN/0
ENTE& T:E ITE( &ATE6 NNN1;.<0
Conclusion:
rom the program we observe that the file is created and the five records
of the five products are entered into the file and are stored in the file.
Sheet No: 33
Program No: 2#
Aim: %rogram to displa@ the product details stored in a file named ITE(.DAT.
Analysis: In this program we can displa@ a file b@ the !"5"1 program to read from the
file. *e have to read the name of file and records of the file and later during the
eEecution i.e., during the runtime we can displa@ the records from the file one b@ one and
have a counter variable and during the end of the file we can =uit from the eEecution.

Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
EN#I&"N(ENT DI#I$I"N.
IN%2T)"2T%2T $E!TI"N.
I1E)!"NT&"1
$E1E!T ITE()I1E A$$I'N T" DI$+
"&'ANILATI"N I$ $EM2ENTIA1.
DATA DI#I$I"N.
I1E $E!TI"N.
D ITE()I1E
1A5E1 &E!"&D$ A&E $TANDA&D
#A12E " I1E)ID I$ 4ITE(.DAT4
DATA &E!"&D I$ ITE()&E!.
01 ITE()&E!.
0; I!"DE %I! -.G0.
0; INA(E %I! C.100.
0; IMT3 %I! -.G0.
0; I&ATE %I! -./0#--.
*"&+IN')$T"&A'E $E!TI"N.
01 !: %I! C #A12E 4N4.
%&"!ED2&E DI#I$I"N.
(AIN)%A&A.
"%EN IN%2T ITE()I1E.
&EAD ITE()I1E AT END ("#E 434 T" !:.
%E&"&( %A&A)1 2NTI1 !: 8 434 "& 4@4.
!1"$E ITE()I1E.
$T"% &2N.
%A&A)1.
DI$%1A3 .1 , 10 E&A$E.
DI$%1A3 .- , 1/0 4ITE( !"DE64.
DI$%1A3 .- , G/0 I!"DE.
DI$%1A3 .11 , 1/0 4ITE( NA(E64.
DI$%1A3 .11 , G/0 INA(E.
DI$%1A3 .1< , 1/0 4ITE( M2ANTIT364.
DI$%1A3 .1< , G/0 IMT3.
Sheet No: 34
DI$%1A3 .1/ , 1/0 4ITE( &ATE64.
DI$%1A3 .1/ , G/0 I&ATE.
$T"% 4 4.
DI$%1A3 .1, , G00 4%&E$$ ENTE& T" !"NTIN2E...4.
&EAD ITE()I1E AT END ("#E 434 T" !:.
Output:
ITE( !"DE6 00G/
ITE( NA(E6 cosmetics
ITE( M2ANTIT36 0010
ITE( &ATE6 000</./0
%&E$$ ENTE& T" !"NTIN2EJ
JJJJJJJJJJJJJJJJJJ
JJJJJJJJJJJJJJJJJJ
JJJJJJJJJJJJJJJJJJ
ITE( !"DE6 01G;
ITE( NA(E6 homeneeds
ITE( M2ANTIT36 00/0
ITE( &ATE6 0001;.<0
%&E$$ ENTE& T" !"NTIN2EJ
Conclusion:
rom the program we observe that the file created is opened and the five
records of the five products are read from the file and are displa@ed on the screen.
Sheet No: 35
Program No: 21
Aim: %rogram to store the account details in an indeEed file named A!!"2NT.DAT.
Analysis: In this program we can create an indeEed file b@ the !"5"1 program to write
into the file. *e have to name the file and records of the file and set one field as the ?e@
to access the file records and later during the eEecution i.e., during the runtime we can
enter the records into the file through the ?e@board and can store in the file. 5ut we can
displa@ the contents of the file b@ another program.

Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
EN#I&"N(ENT DI#I$I"N.
IN%2T)"2T%2T $E!TI"N.
I1E)!"NT&"1
$E1E!T A!!)I1E A$$I'N T" DI$+
"&'ANILATI"N I$ INDECED
&E!"&D +E3 I$ A!!)!"DE A!!E$$ ("DE I$ $EM2ENTIA1.
DATA DI#I$I"N.
I1E $E!TI"N.
D A!!)I1E
1A5E1 &E!"&D$ A&E $TANDA&D
#A12E " I1E)ID I$ 4A!!"2NT.DAT4
DATA &E!"&D I$ A!!)&E!.
01 A!!)&E!.
0; A!!)!"DE %I! -.G0.
0; A!!)NA(E %I! C.;00.
0; A!!)ADD& %I! C./00.
0; A!!)A(T %I! -.,0#--.
*"&+IN')$T"&A'E $E!TI"N.
%&"!ED2&E DI#I$I"N.
(AIN)%A&A.
"%EN "2T%2T A!!)I1E.
%E&"&( %A&A)1 / TI(E$.
!1"$E A!!)I1E.
$T"% &2N.
%A&A)1.
DI$%1A3 .1 , 10 E&A$E.
DI$%1A3 .- , 1/0 4ENTE& T:E A!!"2NT !"DE64.
A!!E%T .- , G/0 A!!)!"DE *IT: %&"(%T.
DI$%1A3 .11 , 1/0 4ENTE& T:E A!!"2NTEE NA(E64.
A!!E%T .11 , G/0 A!!)NA(E *IT: %&"(%T.
DI$%1A3 .1< , 1/0 4ENTE& T:E A!!"2NTEE ADD&E$$64.
A!!E%T .1< , G/0 A!!)ADD& *IT: %&"(%T.
Sheet No: 36
DI$%1A3 .1/ , 1/0 4ENTE& T:E A!!"2NT 5A1AN!E64.
A!!E%T .1/ , G/0 A!!)A(T *IT: %&"(%T.
*&ITE A!!)&E!.
Output:
ENTE& T:E A!!"2NT !"DE6 100;
ENTE& T:E A!!"2NTEE NA(E6 raOa rao
ENTE& T:E A!!"2NTEE ADD&E$$6 mala?pet,h@d
ENTE& T:E A!!"2NT 5A1AN!E6 NN/0000.GH
JJJJJJJJJJJJJJJJJJJJJJ..
JJJJJJJJJJJJJJJJJJJJJJ..
JJJJJJJJJJJJJJJJJJJJJJ..
ENTE& T:E A!!"2NT !"DE6 10;0
ENTE& T:E A!!"2NTEE NA(E6 ?rishna rao
ENTE& T:E A!!"2NTEE ADD&E$$6 ameerpet,h@d
ENTE& T:E A!!"2NT 5A1AN!E6 NN10100./B
Conclusion:
rom the program we observe that the file is created as indeEed and the
five records of the five accountees are entered into the file and are stored in the file.
Sheet No: 3
Program No: 22
Aim: %rogram to displa@ the accountees details stored in an indeEed file named
A!!"2NT.DAT.
Analysis: In this program we can displa@ an indeEed file b@ the !"5"1 program to read
from the file. *e have to read the name of file and records of the file and later during the
eEecution i.e., during the runtime we can displa@ the records from the file one b@ one and
have a counter variable and during the end of the file we can =uit from the eEecution.

Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
EN#I&"N(ENT DI#I$I"N.
IN%2T)"2T%2T $E!TI"N.
I1E)!"NT&"1
$E1E!T A!!)I1E A$$I'N T" DI$+
"&'ANILATI"N I$ INDECED
&E!"&D +E3 I$ A!!)!"DE A!!E$$ ("DE I$ $EM2ENTIA1.
DATA DI#I$I"N.
I1E $E!TI"N.
D A!!)I1E
1A5E1 &E!"&D$ A&E $TANDA&D
#A12E " I1E)ID I$ 4A!!"2NT.DAT4
DATA &E!"&D I$ A!!)&E!.
01 A!!)&E!.
0; A!!)!"DE %I! -.G0.
0; A!!)NA(E %I! C.;00.
0; A!!)ADD& %I! C./00.
0; A!!)A(T %I! -.,0#--.
*"&+IN')$T"&A'E $E!TI"N.
01 !: %I! C #A12E 4N4.
%&"!ED2&E DI#I$I"N.
(AIN)%A&A.
"%EN IN%2T A!!)I1E.
&EAD A!!)I1E AT END ("#E 434 T" !:.
%E&"&( %A&A)1 2NTI1 !: 8 434 "& 4@4.
!1"$E A!!)I1E.
$T"% &2N.
%A&A)1.
DI$%1A3 .1 , 10 E&A$E.
DI$%1A3 .- , 1/0 4A!!"2NT !"DE64.
DI$%1A3 .- , G/0 A!!)!"DE.
DI$%1A3 .11 , 1/0 4A!!"2NTEE NA(E64.
DI$%1A3 .11 , G/0 A!!)NA(E.
Sheet No: 3!
DI$%1A3 .1< , 1/0 4A!!"2NTEE ADD&E$$64.
DI$%1A3 .1< , G/0 A!!)ADD&.
DI$%1A3 .1/ , 1/0 4A!!"2NT 5A1AN!E64.
DI$%1A3 .1/ , G/0 A!!)A(T.
$T"% 4 4.
DI$%1A3 .1, , G00 4%&E$$ ENTE& T" !"NTIN2E...4.
&EAD A!!)I1E AT END ("#E 434 T" !:.
Output:
A!!"2NT !"DE6 100;
A!!"2NTEE NA(E6 raOa rao
A!!"2NTEE ADD&E$$6 mala?pet,h@d
A!!"2NT 5A1AN!E6 00/0000.GH
JJJJJJJJJJJJJJJJJJJJJJ..
JJJJJJJJJJJJJJJJJJJJJJ..
JJJJJJJJJJJJJJJJJJJJJJ..
A!!"2NT !"DE6 10;0
A!!"2NTEE NA(E6 ?rishna rao
A!!"2NTEE ADD&E$$6 ameerpet,h@d
A!!"2NT 5A1AN!E6 0010100./B
Conclusion:
rom the program we observe that the file created is opened and the five
records of the five accounts are read from the file and are displa@ed on the screen.
Sheet No: 3"
Program No: 23
Aim: %rogram to store the customer details in a relative file named !2$T"(E&.DAT.
Analysis: In this program we can create a relative file b@ the !"5"1 program to write
into the file. *e have to name the file and records of the file and set one field as the ?e@
to access the file records and later during the eEecution i.e., during the runtime we can
enter the records into the file through the ?e@board and can store in the file. 5ut we can
displa@ the contents of the file b@ another program.

Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
EN#I&"N(ENT DI#I$I"N.
IN%2T)"2T%2T $E!TI"N.
I1E)!"NT&"1
$E1E!T !2$T)I1E A$$I'N T" DI$+
"&'ANILATI"N I$ &E1ATI#E
&E1ATI#E +E3 I$ &E!)N"
A!!E$$ ("DE I$ D3NA(I!.
DATA DI#I$I"N.
I1E $E!TI"N.
D !2$T)I1E
1A5E1 &E!"&D$ A&E $TANDA&D
#A12E " I1E)ID I$ 4!2$T"(E&.DAT4
DATA &E!"&D I$ !2$T)&E!.
01 !2$T)&E!.
0; !)N" %I! -.G0.
0; !)NA(E %I! C.;00.
0; D2E %I! -.,0#--.
*"&+IN')$T"&A'E $E!TI"N.
01 &E!)N" %I! -.<0 #A12E 0.
%&"!ED2&E DI#I$I"N.
(AIN)%A&A.
"%EN "2T%2T !2$T)I1E.
%E&"&( %A&A)1 / TI(E$.
!1"$E !2$T)I1E.
$T"% &2N.
%A&A)1.
ADD 1 T" &E!)N".
DI$%1A3 .1 , 10 E&A$E.
DI$%1A3 .- , 1/0 4ENTE& T:E !2$T"(E& N2(5E&64.
A!!E%T .- , G/0 !)N" *IT: %&"(%T.
DI$%1A3 .11 , 1/0 4ENTE& T:E !2$T"(E& NA(E64.
A!!E%T .11 , G/0 !)NA(E *IT: %&"(%T.
Sheet No: 4#
DI$%1A3 .1< , 1/0 4ENTE& T:E D2E A("2NT64.
A!!E%T .1< , G/0 D2E *IT: %&"(%T.
*&ITE !2$T)&E!.
Output:
ENTE& T:E !2$T"(E& N2(5E&6 NNN1
ENTE& T:E !2$T"(E& NA(E6 ramarao
ENTE& T:E D2E A("2NT6 NNN100;.<G
JJJJJJJJJJJJJJJJJJJJ.
JJJJJJJJJJJJJJJJJJJJ.
JJJJJJJJJJJJJJJJJJJJ.
ENTE& T:E !2$T"(E& N2(5E&6 NNN/
ENTE& T:E !2$T"(E& NA(E6 raghava
ENTE& T:E D2E A("2NT6 NNN1;/G.<B
Conclusion:
rom the program we observe that the file is created as relative and the
five records of the five customers are entered into the file and are stored in the file.
Sheet No: 41
Program No: 24
Aim: %rogram to displa@ the customer details stored in a relative file named
A!!"2NT.DAT.
Analysis: In this program we can displa@ a relative file b@ the !"5"1 program to read
from the file. *e have to read the name of file and records of the file and later during the
eEecution i.e., during the runtime we can displa@ the records from the file one b@ one b@
giving the customer number and can =uit out of the eEecution onl@ if we enter N option at
the prompt for continuation.

Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
EN#I&"N(ENT DI#I$I"N.
IN%2T)"2T%2T $E!TI"N.
I1E)!"NT&"1
$E1E!T !2$T)I1E A$$I'N T" DI$+
"&'ANILATI"N I$ &E1ATI#E
&E1ATI#E +E3 I$ &E!)N"
A!!E$$ ("DE I$ D3NA(I!.
DATA DI#I$I"N.
I1E $E!TI"N.
D !2$T)I1E
1A5E1 &E!"&D$ A&E $TANDA&D
#A12E " I1E)ID I$ 4!2$T"(E&.DAT4
DATA &E!"&D I$ !2$T)&E!.
01 !2$T)&E!.
0; !)N" %I! -.G0.
0; !)NA(E %I! C.;00.
0; D2E %I! -.,0#--.
*"&+IN')$T"&A'E $E!TI"N.
01 &E!)N" %I! -.<0 #A12E 0.
01 %I! C #A12E 434.
01 !: %I! C #A12E 434.
%&"!ED2&E DI#I$I"N.
(AIN)%A&A.
"%EN IN%2T !2$T)I1E.
%E&"&( %A&A)1 2NTI1 !: 8 4N4 "& 4n4.
!1"$E !2$T)I1E.
$T"% &2N.
%A&A)1.
ADD 1 T" &E!)N".
DI$%1A3 .1 , 10 E&A$E.
DI$%1A3 .- , 1/0 4ENTE& T:E !2$T"(E& N2(5E&64.
Sheet No: 42
A!!E%T .- , G/0 &E!)N" *IT: %&"(%T.
&EAD !2$T)I1E IN#A1ID +E3 ("#E 4N4 T" .
I 84N4
%E&"&( %A&A);
E1$E
%E&"&( %A&A)<
%E&"&( %A&A)G.
%A&A);.
DI$%1A3 .1< , ;/0 4IN#A1ID !2$T"(E& N2(5E&4.
%A&A)<.
DI$%1A3 .1< , 1/0 4!2$T"(E& NA(E64.
DI$%1A3 .1< , G/0 !)NA(E.
DI$%1A3 .1/ , 1/0 4D2E A("2NT64.
DI$%1A3 .1/ , G/0 D2E.
%A&A)G.
DI$%1A3 .;0 , 100 4AN3 ("&EP3KNQ64.
A!!E%T .;0 , <00 !: *IT: A2T")$+I%.
Output:
ENTE& T:E !2$T"(E& N2(5E&6 NN1
!2$T"(E& NA(E6 ramarao
D2E A("2NT6 000100;<G
AN3 ("&EP3KNQ6 3
JJJJJJJJJJJJJJJJJJ..
JJJJJJJJJJJJJJJJJJ..
JJJJJJJJJJJJJJJJJJ..
ENTE& T:E !2$T"(E& N2(5E&6 NN/
!2$T"(E& NA(E6 raghava
D2E A("2NT6 0001;/G<B
AN3 ("&EP3KNQ6N
Conclusion:
rom the program we observe that the relative file created is opened and
the five records of the five customers are read from the file and are displa@ed on the
screen b@ reading the customer number.
Sheet No: 43
Program No: 25
Aim: %rogram to merge the files DE%T1.DAT, DE%T;.DAT into DE%T<.DAT.
Analysis: In this program we can merge two data files created alread@ with some records
in it and displa@ the merged file one b@ one in a se=uence. :ere we merge the first and
second files into a third file and displa@ records in the third file that is the merged file one
b@ one at runtime.

Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
EN#I&"N(ENT DI#I$I"N.
IN%2T)"2T%2T $E!TI"N.
I1E)!"NT&"1.
$E1E!T DE%T1)I1E A$$I'N T" DI$+
"&'ANILATI"N I$ 1INE $EM2ENTIA1.
$E1E!T DE%T;)I1E A$$I'N T" DI$+
"&'ANILATI"N I$ 1INE $EM2ENTIA1.
$E1E!T DE%T<)I1E A$$I'N T" DI$+
"&'ANILATI"N I$ 1INE $EM2ENTIA1.
$E1E!T *"&+IN')I1E A$$I'N T" DI$+
"&'ANILATI"N I$ 1INE $EM2ENTIA1.
DATA DI#I$I"N.
I1E $E!TI"N.
D DE%T1)I1E
1A5E1 &E!"&D$ A&E $TANDA&D
#A12E " I1E)ID I$ 4DE%T1.DAT4
DATA &E!"&D I$ DE%T1)&E!.
01 DE%T1)&E!.
0; AEN" %I! -.<0.
0; AENA %I! C.1/0.
0; A5$ %I! -.,0#--.
0; A:&A %I! -.,0#--.
0; ADA %I! -.,0#--.
D DE%T;)I1E
1A5E1 &E!"&D$ A&E $TANDA&D
#A12E " I1E)ID I$ 4DE%T;.DAT4
DATA &E!"&D I$ DE%T;)&E!.
01 DE%T;)&E!.
0; 5EN" %I! -.<0.
0; 5ENA %I! C.1/0.
0; 55$ %I! -.,0#--.
0; 5:&A %I! -.,0#--.
0; 5DA %I! -.,0#--.
Sheet No: 44
D DE%T<)I1E
1A5E1 &E!"&D$ A&E $TANDA&D
#A12E " I1E)ID I$ 4DE%T<.DAT4
DATA &E!"&D I$ DE%T<)&E!.
01 DE%T<)&E!.
0; !EN" %I! -.<0.
0; !ENA %I! C.1/0.
0; !5$ %I! -.,0#--.
0; !:&A %I! -.,0#--.
0; !DA %I! -.,0#--.
$D *"&+IN')I1E
DATA &E!"&D I$ *"&+IN')&E!.
01 *"&+IN')&E!.
0; *EN" %I! -.<0.
0; *ENA %I! C.1/0.
0; *5$ %I! -.,0#--.
0; *:&A %I! -.,0#--.
0; *DA %I! -.,0#--.
*"&+IN')$T"&A'E $E!TI"N.
01 !: %I! C #A12E 4N4.
%&"!ED2&E DI#I$I"N.
(AIN)%A&A.
(E&'E *"&+IN')I1E "N A$!ENDIN' +E3 *EN"
2$IN' DE%T1)I1E DE%T;)I1E 'I#IN' DE%T<)I1E.
"%EN IN%2T DE%T<)I1E.
&EAD DE%T<)I1E AT END ("#E 434 T" !:.
%E&"&( %A&A)1 2NTI1 !: 8 434.
$T"% &2N.
%A&A)1.
DI$%1A3 .1 , 10 E&A$E.
DI$%1A3 .- , 1/0 4E(%1"3EE N"64.
DI$%1A3 .- , G/0 !EN".
DI$%1A3 .11 , 1/0 4E(%1"3EE NA(E64.
DI$%1A3 .11 , G/0 !ENA.
DI$%1A3 .1< , 1/0 45A$I! $A1A&364.
DI$%1A3 .1< , G/0 !5$.
DI$%1A3 .1/ , 1/0 4:.&.A.64.
DI$%1A3 .1/ , G/0 !:&A.
DI$%1A3 .1, , 1/0 4D.A.64.
DI$%1A3 .1, , G/0 !DA.
DI$%1A3 .;0 , 100 4 4.
$T"% 4%&E$$ ENTE& T" !"NTIN2E...4.
&EAD DE%T<)I1E AT END ("#E 434 T" !:.
Sheet No: 45
Output:
E(%1"3EE N"6 01
E(%1"3EE NA(E6 Amar
5A$I! $A1A&36 000/000
:.&.A.6 000000/00
D.A.6 0000000/0
%&E$$ ENTE& T" !"NTIN2E...
JJJJJJJJJJJJJJJJJJJJ.
JJJJJJJJJJJJJJJJJJJJ.
JJJJJJJJJJJJJJJJJJJJ.
E(%1"3EE N"6 0B
E(%1"3EE NA(E6 eroO
5A$I! $A1A&36 000G000
:.&.A.6 000000;00
D.A.6 0000000;0
%&E$$ ENTE& T" !"NTIN2E...
Conclusion:
rom the above program we observe that the first two files are merged in a
third file and are displa@ed on the screen one b@ one until the end of the file.
Sheet No: 46
Program No: 26
Aim: %rogram to sort a file A!!"2NT.DAT into the file $A!!"2NT.DAT.
Analysis: In this program we can we can sort a file which is alread@ created into another
file. :ere in this program the records are sorted according to their account number in the
ascending order and are stored in the other file. 5ut we can displa@ the sorted records b@
another program to displa@ the records of the file.

Source Code:
IDENTII!ATI"N DI#I$I"N.
%&"'&A()ID.
EN#I&"N(ENT DI#I$I"N.
IN%2T)"2T%2T $E!TI"N.
I1E)!"NT&"1.
$E1E!T A!!"2NT)I1E A$$I'N T" DI$+
"&'ANILATI"N I$ 1INE $EM2ENTIA1.
$E1E!T $A!!"2NT)I1E A$$I'N T" DI$+
"&'ANILATI"N I$ 1INE $EM2ENTIA1.
$E1E!T *"&+IN')I1E A$$I'N T" DI$+
"&'ANILATI"N I$ 1INE $EM2ENTIA1.
DATA DI#I$I"N.
I1E $E!TI"N.
D A!!"2NT)I1E
1A5E1 &E!"&D$ A&E $TANDA&D
#A12E " I1E)ID I$ 4A!!"2NT.DAT4
DATA &E!"&D I$ A!!"2NT)&E!.
01 A!!"2NT)&E!.
0; A!!)N" %I! -./0.
0; A!!)NA(E %I! C.;00.
0; A!!)DATE %I! C.H0.
0; T&AN)DATE %I! C.H0.
D $A!!"2NT)I1E
1A5E1 &E!"&D$ A&E $TANDA&D
#A12E " I1E)ID I$ 4$A!!"2NT.DAT4
DATA &E!"&D I$ $A!!"2NT)&E!.
01 $A!!"2NT)&E!.
0; $A!!)N" %I! -./0.
0; $A!!)NA(E %I! C.;00.
0; $A!!)DATE %I! C.H0.
0; $T&AN)DATE %I! C.H0.
$D *"&+IN')I1E.
01 *"&+IN')&E!.
0; *A!!)N" %I! -./0.
0; *A!!)NA(E %I! C.;00.
Sheet No: 4
0; *A!!)DATE %I! C.H0.
0; *T&AN)DATE %I! C.H0.
*"&+IN')$T"&A'E $E!TI"N.
%&"!ED2&E DI#I$I"N.
(AIN)%A&A.
$"&T *"&+IN')I1E "N A$!ENDIN' +E3 *A!!)N"
2$IN' A!!"2NT)I1E 'I#IN' $A!!"2NT)I1E.
$T"% &2N.
Output:
.Displa@ed using the program to displa@ the records of the file0
A!!"2NT N"6 00001
A!!"2NT NA(E6 A(A&
A!!"2NT DATE6 11.0;.0B
T&AN$A!TI"N DATE6 1;.0<.0B
%&E$$ ENTE& T" !"NTIN2EJ
JJJJJJJJJJJJJJJJJJ.
JJJJJJJJJJJJJJJJJJ.
JJJJJJJJJJJJJJJJJ....
A!!"2NT N"6 0000/
A!!"2NT NA(E6 E&"I
A!!"2NT DATE6 10.10.0B
T&AN$A!TI"N DATE6 0<.1;.0B
%&E$$ ENTE& T" !"NTIN2EJ
Conclusion:
rom the above program we can observe that the records in one file are
sorted and are stored in the other file according to the account number. The@ are
displa@ed using the other program to displa@ the records of the file.

Das könnte Ihnen auch gefallen