Вы находитесь на странице: 1из 12

1.write a pgm to display a msg on the screen?

Identification division.
Program-id. Disppgm.
Environment division.
Data division.
Procedure division.
Display ‘sureshkumar’.
Stop run.
2.write a pgm to add two num’s and store the
results in third variable?
Identification division.
Program-id. Addpgm.
Environment division.
Data division.
Working-storage section.
01 ws-a pic 9(5) value 30000.
01 ws-b pic 9(5) value 40000.
01 ws-c pic 9(5) value 50000.
Procedure division.
Compute ws-c = ws-a + ws-b.
Display ’ws-c:’ws-c.
Stop run.
3.write a pgm to display single emp details?
Identification division.
Program-id. Empdet.
Environment division.
Data division.
Working-storage section.
01 emp-det.
05 emp-name pic x(10) value ‘suresh’.
05 emp-loc.
10 city pic x(10) value ‘hyd’.
10 state pic x(10) value ‘ap’.
05 emp-id pic 9(10) value 1111.
05 emp-sal pic 9(10) value 50000.
Procedure division.
Display emp-det.
Stop run.

4.add two nums and store the results in third


variable by using move verb?
identification division.
Program-id. Move1.
Environment division.
Data division.
Working-storage section.
01 a pic 9(10) value 4000.
01 b pic 9(10) value zeros.
01 c pic 9(10) value zeros.
Procedure division.
Move a to b.
Compute c = a + b.
Display c.
Stop run.

5.wap to move alphanumerics ?


Identification divison.
Program-id. Alph1.
Environment division.
Data division.
Working-storage section.
01 a pic x(10) value ‘suresh’.
01 b pic x(4) value spaces.
Procedure division.
Move a to b.
Display a.
Display b.
Stop run.
In alpha numeric’s omit the r.h.s data. means it will
takes only first 4 characters. in numeric it will be
reverse

6.write a pgm to add2 number by using accept


verb?( Values given dynamically)
Identification division.
Program-id. Dynm1.
Environment division.
Data division.
Working-storage section.
01 a pic 9(10) value zeros.
01 b pic 9(10) value zeros.
01 c pic 9(10) value zeros.
Procedure division.
Accept a.
Accept b.
Compute c = a + b.
Display c.
Stop run.
7.w.a.p to find greater among two numbers?
Identification division.
Program-id. Biggest.
Environment division.
Data division.
Working-storage section.
01 a pic 9(10) value zeros.
01 b pc 9(10) value zeros.
Procedure division.
Accept a.
Accept b.
If a > b
Display ‘a is bigger’
Else
Display ‘b is bigger’
End-if.
Stop run.

8.w.a.p to find greater among three numbers?


Identification division.
Program-id. Big2.
Environment division.
Data division.
Working-storage section. In bgrade
01 a pic 9(10) value zeros.
01 b pic 9(10) value zeros.
01 c pic 9(10) value zeros.
Procedure division.
Accept a.
Accept b.
Accept c.
If a > b and a>c
Display ‘a is bigger’
else if
b > c and b > a
display ‘b is bigger’
else
display ‘c is bigger’
end-if.
end-if.

Stop run.
9.w.a.p by using evaluate condition?
Identification division.
Program-id. Eval1.
Environment division.
Data division.
Working-storage section.
01 ws-mon-num pic 9(2) value zeros.
Procedure division.
Accept ws-mon-num.
Evaluate ws-mon-num
When 01
Display’month is jan’
When 02
Display’month is feb’
|
|
|
When other
Display’enter valid num’
End-evaluate.
Stop run.
10.w.a.p to calculate sum,avg of student marks?
Identification division.
Program-id. Stdm.
Environment division.
Data division.
Working-storage section.
01 s1 pic 9(4) value zeros.
01 s2 pic 9(4) value zeros.
01 s3 pic 9(4) value zeros.
01 sum pic 9(4) value zeros.
01 avg pic 9(4) v 9(2) value zeros.
Procedure division.
Accept s1.
Accept s2.
Accept s3.
Compute sum = s1+s2+s3.
Compute avg = sum/3.
Display’sum:’sum.
Display’avg:’avg.
Evaluate avg.
When 80 thru 100
Display’distinction’.
When 60 thru 79
Display’firstclass’.
When 40 thru 59
Display’secondclass’.
When 20 thru 39
Display’thirdclass’.
When 00 thru 19
Display’fail’.
When other
Display’invalid num’.
End-evaluate.
Stop run.

11.w.a.p by using evaluate true?


Identification division.
Program-id. Eval1.
Environment division.
Data division.
Working-storage section.
01 gender pic x(6) value zeros.
88 male value ‘m’.
88 female value’f’.
Procedure division.
Accept gender.
Evaluate true
When m
Display ‘male’
When f
Display ‘female’
When other
Display ‘enter valid option’
End-evaluate.
Stop run.

12.w.a.p by using evaluate also?


Indentification division.
Program-id. Evalals.
Environment division.
Data division.
Working-storage section.
01 sex pic x(17) value spaces.
01 tax pic 9(10) v 9(2) value zeros.
01 sal pic 9(10) value zeros.
Procedure division.
1000-mainpara.
Move 10000 to sal.
Move m to sex

Вам также может понравиться