Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a cobol program to display prime numbers between 1 to 100?

Answer Posted / satyabrata nanda

Logic:
01 Var.
05 VarX Pic 9(2) Value zeros.
05 QNT Pic 9(2) value zeros.
05 REM Pic 9(2) value zeros.
05 CNT Pic 9(2) value zeros.
Procedure Div.

Display ' Enter VarX = '
Accept VarX.
If VarX = '1'
Display 'Prime no'
Else
Perform varying CNT from 2 by 1 until CNT >= VarX
Divide CNT into VarX giving QNT reminder REM
If rem > zero
Display 'Prime No'
Else
Display 'Not Prime'
End-if
End-if.

Is This Answer Correct ?    4 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is redefine?

1215


Explain the input procedure?

936


Define redefine and its syntax?

964


Explain the difference between search and searchall?

862


Define perform? And its types?

979


What is the syntax of redefine?

943


What is sort?

945


Explain the syntax of sort?

966


Define redefine?

1115


Define perform?

990


What are fillers? What is the actual use of fillers? With mall/simple example?

996


What is input procedure?

988


What are fillers?

1029


why icetool be used in programmer view?

2564


How to detect record is locked in cobol/400? What is the solution for that?

961