Write a program to display prime numbers between 1 to 100 using RPGLE.



Write a program to display prime numbers between 1 to 100 using RPGLE...

Answer / saravanan3

D N S 2P 0 INZ 0
D Q S 2P 0
D R S 2P 0
D I S 2P 0

C PARM N
MOVE 2 I
DOU I >= N
I DIV N Q
MVR R
IF R=0
“Number is not PRIME” DSPLY
ENDIF
ADD 1 I
ENDDO
IF N=I
THEN
“Number is PRIME” DSPLY
ENDIF
C SETON LR

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More RPG400 Interview Questions

can anybody help me to solve this problem. the program that i m checking display error message saying "Record format for file AJDSPFFD does not match model file and decimal error. how to solve this problem. The AJDSPFFD is snapshot the AJTLOG that is the audit trail list.

0 Answers  


what is meant by record lock.how records are locked.what is the purpose of record lock.if records are locked what happens.how to find out which record is locked.

4 Answers   HCL,


How do you code file / field renames in ILE RPG?

4 Answers   Accenture, IBM,


what is batch debug in as400?

3 Answers  


What is difference between bind by copy and bind by reference?

0 Answers  






How to get only unique records from a file which contains duplicate data using CPYF command ? Example : FILEA has duplicate records and FILEB is a UNIQUE defined.... and I want to get the data from FILEA to FILEB by eliminating all the duplicate records...

2 Answers  


1.CA(command Atention key)& CF(command Function key) difference with example?Please can any body tell me in real time exp? 2.Can any body tell me some mandatery function keys using while creating any screen with use of SDA-FUNCTION kEYS?

5 Answers   HCL,


How to print output from openquery in as400 ?

1 Answers   Four soft,


what is file information data structure?

1 Answers   IBM,


1.Coding in cl to send an message? 2..What is turnover and use? What are the different levels?

4 Answers   IBM,


i want code and what are used key words are ...like wrkmbrpdm screen (q) i have a file with 3 fields empno,empname,empaddr... here you give the empno it displays from that number to remaining empno's how? sub file screen: employee details pos to:empno then enter empno empname empaddr so file have 100 records from 1 to 100 so the above pos you give the 55 empno...it displays the from 55 to remaining... ...... please share this answel

2 Answers   IBM,


i want to retrieve record b/w 2 dates in as400

2 Answers   L&T,


Categories