# Program to Display Given Numbers in Words – Control Statements – C Programming Language

October 20, 2019

Hello Friends et’s try one more code a very important code from the examination point of view like how exactly I display the given integer number inputs if I go back to my good old a number that is a 523 I have the number as 523 at a now display the not the individual digits but the word corresponding to a particular agent for example the first digit corresponds to five the second digit corresponds to two the third digit corresponds to three some suppose display on screen five space 2 space 3 if the number is five point III if the number 11 6 to 7 then I coulda said 6 space 2 space 7 so to basically read a number and then display these individual digits again if you remember that I am supposed to now extract the leftmost digit and we have concluded that it is not directly possible to extract the leftmost Richard so if I could extract the leftmost leftmost digit then what are you do is and find the reverse of the spherical number so when we reverse the spherical number from 523 to 325 so that the extreme left most number will now be the rightmost number and we can extract the rightmost digit by just saying more 10 so I can say Martin and extract this particular shit so if I if I take the 523 number so first what it is you reverse this number to 325 we have seen the logic in the previous examples how do I convert 523 to 325 so once your 325 were done then extract this widget we know how to extract these digits so we can say more it in so when I say more 10 I have to now take this number and compare this with the words of this particular is it that every time the unit position will be fine for this example it is fine for any example this can be any digit which is from 0 to 9 so do remember that for this example this is Phi but this can take up any value from 0 to 9 if it says that I am substrate it can take any value from 0 to 9 I had to compare this in digit 0 1 2 3 4 5 6 7 8 9 and appropriately I’m supposed to split word for this so it means that I have to again extract the digits from this particular part take 5 mega comparison and then display five-10 tape 2 and display TW o take the next digit that is 3 and again display th r double e so we have to display these individual digits in words based on the extraction so the logic will be simple first take the input then find the reverse of the number and then extract these reverse digits as and when they are extracted when they are extracted to make a comparison immediately but here the comparison of this particular digit has to done for 10 different values that is from 0 to 9 so when I said I am supposed to make a comparison with the 10 values that if I say that this result is stored as are the possible values of r are 0 to 9 start we use a filter ladder if R equal to equal to 0 printf 0 else R equal to equal to 1 printf 1 as Ari could equal to printf 2 and so on and so on or else I give you the simple switch case I can say switch R & R can take a bond 2 3 4 5 so I can print that bling clip Alice let’s start this particular program I have this particular program with me let me try to present this particular program and explain the logical stuff which goes beyond this particular example so I have said two parts first read the number that is your input part and then the operation in this operation again divides operation through two simple steps first operation is to get the reverse of the number so or I get the reverse of the number so the reverse of the number is same as the previous logic while n greater than zero are good and more than n equal to n right n The Rave equal to real a strict n plus R so this entire loop gets you the reverse of the number so firstly the number and then find the reverse of the Nova now start extracting the digits from the reverse now the extraction is done using these two instructions so it says the real zero if I take up the number of 523 the reverse of that is now you have to say it without having those numbers written on the paper because we have done sufficient examples where you can very easily follow what is the improved I’m saying so the number is 325 sorry 523 the reverse will get you 325 whenever I take a pause make sure that you spell it leaves the values internally 325 greater than zero true true in the sense exact number 325 more ten is what Phi 324 by ten is what 32 switch are the value of R in this case is five go to case of Phi I have case far this place it says printf I break and break will take you outside this particular so FK 0 case one case two case three case for case v k6 k 7k 8k s nine and here it has displayed is 0 1 2 3 4 5 and i have left a space and deliberately after each of these output so that on the output screen two words will be separated of blank space not necessarily have a default because when the user enters a number the reverse of the number will contain bridges from 0 to 9 itself so every case has to be left with one space and then a colon symbol and then a break will take you outside this but when a break takes outside here it takes a switch case but the loop still continues so loop is now 32 go back 32 grid and 0 through 32 Martin is 2 that is shown into a review go to do by 10:30 2 by 10 is 3 switch our rs2 printer to it now displays a to next to word cutters 5 break will take outside loop continues 3 grid and 0 through 3 Martin is 3 3 button is 0 switch 3 case 3 printf 3 into print 3 order break will take outside go back arrived is 0 0 1 0 false false put an end of this particular task so here we have displayed the numbers in words just by avoiding printf are you can now take this particular R for comparison for 10 different cases and print these digits in words so I feel the logical is now more easy to understand because we have said it sufficient times hence when when you do the last example of your choice definitely you have to memorize those expressions the expression should come to you whenever I speak when I observe the memory variables have to flow in front of your eyes n is 523 R is garbage river zero extract register first operations second operation third operation take the reverse take the new reverse for the second loop and in that reverse take more it and more and slashed in with that reverse value make the value of R compared with the different cases take the comparison with the switch case advisable if else advise not advisable because we have multiple conditions documentation gets disturbed so compare that and if you need a space between two words allocate space put in those two words so a switch case is or can be a part of a while loop also right so once again say that is supposed to pause the video make a copy of the program onto the piece of paper and then I try these programs one more time thank you

Why u had removed your previous videos from YouTube 😭😭at this moment when our exams are near, I have been advertising your channel to so many people, coz ik you are not getting that views which u deserve, but anyways thank you for your help, much appreciated 👏👌

Sir agar hame 25000 no. Diya ho too sir agar hamne iska reverse kiya too 52ayga sir isko hum words mai kaise likhge plz rly me sir fast

for instance user give 23 it must give twenty three … not two three … and three user can enter like 2 "Enter" and after again 3 "Enter" … so name of Video is not correct . Couse it gives name of number by 1 digit where user enters 2 digit !

Can we do using array

If we enter 2500 it gives two five in words in place of two five zero zero

Hello Friends,

Watch Complete Video Series of Subject Structured Programming Approach in C Programming only on Ekeeda Application.

Use Coupon Code "FIRSTTIME" and access any one Subject for Complete one month free.

Download Ekeeda Application and take advantage of this offer.

Android:- https://play.google.com/store/apps/details?id=student.ekeeda.com.ekeeda_student&hl=en

iOS:- https://itunes.apple.com/tt/app/ekeeda/id1442131224

What if we want to Express a given amount in words?

What if the input is 2500.00

The output should be "Rupees Two thousand five hundred paise zero"

lode agr m 2200 print krunga toh zero kon print krega ???papa