Represent any number in Indian Format
This program can convert any given number into the format of Indian Number system. This program is done using python. Basically first the input is passed to a function fix() in which it reverse the number, then if the number's length is less then 3 then it is directly printed or else for first 3 digits of the reversed string a comma is printed and at every even position the comma is printed !
Ping them here !
Screenshots
The Code
def fix(x): z='' i=0 x=x[::-1] if(len(x)<=3): print x[::-1] else: while(i<len(x)): z=z+x[i] if(i==2): z=z+',' elif(i>2 and i<len(x)-1): if((i)%2==0): z=z+',' i=i+1 print z[::-1] for i in range(0, input()): #print '12' x=raw_input() fix(x)Found Suggestions ?
Ping them here !
Comments
Post a Comment