Page 1 of 1

How to do some calculation in a loop ?

Posted: Tue Apr 27, 2010 5:29 am
by pavankatra
Hi
How to do some calculation in a loop ?
loop is given below.. its urgent..
for ( i = 0, n = 0; i < 9; i++ )
{ n += (10 - i) * x.charAt(i) };

Quick help will be appreciated a lot

Please anyone can help me on this issue.

Thanks
Pavan Kumar

Posted: Tue Apr 27, 2010 5:36 am
by chulett
A) It's not urgent for us but I just happen to be up and posting at this time.

B) Why not spell out your requirements in words rather than code? Tell us what you have to do, not how you think you need to do it.

Posted: Tue Apr 27, 2010 6:10 am
by pavankatra
chulett wrote:A) It's not urgent for us but I just happen to be up and posting at this time.

B) Why not spell out your requirements in words rather than code? Tell us what you have to do, not how you think you need to do it.
i want to implement that for loop in the datastage,so can anyone please suggest me how to implement that for loop in Datastage Transformer.

for ( i = 0, n = 0; i < 9; i++ )

{ n += (10 - i) * x.charAt(i) };

Here i want to calculate the sum of n once that loop is over.
Thanks
Pavan Kumar

Posted: Tue Apr 27, 2010 7:55 am
by chulett
Again... in words? Like you were writing a requirement for someone else to follow? Worst case, write your own C++ routine and call that.

Posted: Tue Apr 27, 2010 8:39 am
by Sainath.Srinivasan
Can you let the forum members know why you want that to be solved.

An exact replica was posted few days ago.

Any interview slots to fill ?

Posted: Wed Apr 28, 2010 9:26 am
by pavankatra
Sainath.Srinivasan wrote:Can you let the forum members know why you want that to be solved.

An exact replica was posted few days ago.

Any interview slots to fill ? ...
THanks for your reply.

I have created stage variables to resolve this issue.

Anyway thanks everyone.

Thanks\
Pavan Kumar