Write code logic in c#

Posted by Allemahesh under Others on 7/11/2013 | Points: 10 | Views : 1107 | Status : [Member] [MVP] | Replies : 3
Can any one help me to write a programmer for below logic.
I have function which take int value.
If I pass 1 the it should return 10.
If I pass 2 the it should return 100.
If I pass 3 the it should return 1000.
If I pass 4 the it should return 10000.
If I pass 5 the it should return 100000.
so on.....

Please help me in this.




Responses

Posted by: .Netlearner on: 7/11/2013 [Member] Starter | Points: 25

Up
0
Down
int j=the value u pass
stringbuilder output="1"
for ( int i=1;i<=j;i++)
{
output+"0";
}

int outputval=Convert.ToInt(output.toSting())

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sugi on: 7/12/2013 [Member] Starter | Points: 25

Up
0
Down
Try this.

lblCheckText = "1".PadRight(Convert.ToInt32(txtCheck.Text)+1, '0');


Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 7/12/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
Nice code Sugi

If this post helps you mark it as answer
Thanks

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response