Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum

Complete help forum for students preparing for icse iit aieee cbse pmt and other related exams.Stay updated about all 2011 exams.
 
HomeHome  PortalPortal  FAQFAQ  SearchSearch  RegisterRegister  MemberlistMemberlist  UsergroupsUsergroups  Log in  India NewsIndia News  
Keywords
CLASS RESULT 2010 YEAR
Latest topics
Top posters
abhas
 
Anu..i luv icse...:)
 
G-7
 
siya
 
Candy
 
jOhNy
 
Apurva
 
WinRrule
 
ambili
 
saif
 



Search if you can't find it here

Algorithm to display a 3 digit number in words [ISC]

View previous topic View next topic Go down
AuthorMessage
abhas
Active member
Active member
avatar


PostSubject: Algorithm to display a 3 digit number in words [ISC] Wed Nov 25, 2009 7:47 pm

Algorithm





  • Start.
  • Enter
    a number, of maximum three digits. (n ß
    Input from user)
  • Calculate
    the length of ‘n’.
  • If the
    length is more than three, goto step 5, otherwise goto step 6.
  • Print
    message “"Wrong input only three digit number allowed". Goto
    step 27.
  • Check that wherther the number is greater
    or less than zero.
  • If it
    is greater than zero, print “Positive”, otherwise print “Negative”.
  • Change
    the number ‘n’ to positive by calculating its absolute value and assigning
    it again to ‘n’.
  • Define
    an array “af” containing twenty words from “zero” to “nineteen”.
  • Define
    an array “as” containing nine elements with first elements as null
    character and rest of the elements as multiples of ten from Twenty to
    Ninety.
  • Check
    if the number is less than twenty, if yes goto step 16.
  • Check
    if number is equal to twenty, if yes goto step 17.
  • Check
    if number is less than hundred, if
    yes goto step18
  • Check
    if number is equal to hundred, if yes goto step 21.
  • Otherwise
    goto step 22.
  • Print
    nth index of array “af”. Goto step 27.
  • Print
    “Twenty”. Goto step 27.
  • Extract
    last digit of “n” and store it in integer type variable
    “x”.
  • Divide
    n by 10 and store it in integer type variable y.
  • Print
    y-1 th index of as followed by space and x th index if af. Goto step 27.
  • Print
    “Hundred”. Goto step 27.
  • Extract
    last digit of n and store it in
    integer type variable ‘x’.
  • Divide
    n by 10 and store it in integer type variable ‘y’.
  • Extract
    last digit of y and store it in variable ‘z’.
  • Divide
    y by 10 and store it in variable ‘p’.
  • Print
    p th index of af followed by “hundred” followed by z-1 th index of as followed by x th
    index of af. Goto step 27.
  • Stop.
Back to top Go down
View user profile

Algorithm to display a 3 digit number in words [ISC]

View previous topic View next topic Back to top
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Complete IIT AIEEE ICSE ISC PMT help forum :: ISC :: ISC 2010 [Class xii] :: Computer-