Sunday, May 12, 2013

climbing worm program in c++


C++ Worm Code





#include 
using namespace std; 


int main() 
{ 
int n,d,u,ians; 
while(cin>>n>>u>>d && (n!=0)) 
{ 
ians=0; 
while(n-u>0) 
{ 
n=n-u+d; 
ians+=2; 
} 
ians++; 
cout<<ians<<endl; 
} 
return 0; 
} 


-------------------------------------
C++ Worm Code
(Climbing Worm) | Solved Programming Problems

3 comments: