You can replace the for loop with the while loop.
for(i=0;i<k;i++) can be written asi=0;
while(i<k)
{
/*Do your calculation*/
temp=pow(2,i);
temp=a[i]*temp;
total=total+temp;
i++;
}
Thanks and regards,
Praveen S
On Sun, Mar 8, 2009 at 4:32 PM, ruhatadiyaman <[email protected]>wrote:> thanks for your reply but the problem is this; i have to solve this > problem only by using 'while' and 'if' key words. i have not studied arrays > yet. i am working on 'structured program development in c' from the Deitel's > book. if you checked my codes, you might have seen that it includes only > 'while, if'. if you write it again, it will be very good for me. > best regards > > > [Non-text portions of this message have been removed]
