Jump to content

Red Dragon Triad - Discuţii/Discussions


Alexander
 Share

Recommended Posts

Mai am 3h si ajung si eu acasa sunt la info , invatati si voi ceva :

 

 

#include <cstdlib>

#include <iostream>

using namespace std;

int main(int argc, char *argv[])

{

 

 

int result ,a,b;

result=0;

a=10;

while(a>0)

{

b=1;

do

{

a-=b;

result+=b;

b*=2;

}

while(b<a);

 

 

result+=a;

}

cout<<a<<" "<<b<<" "<<result<<endl;

system("PAUSE");

return EXIT_SUCCESS;

}

Link to comment
Share on other sites

Mai am 3h si ajung si eu acasa sunt la info , invatati si voi ceva :

 

 

#include <cstdlib>

#include <iostream>

using namespace std;

int main(int argc, char *argv[])

{

 

 

int result ,a,b;

result=0;

a=10;

while(a>0)

{

b=1;

do

{

a-=b;

result+=b;

b*=2;

}

while(b<a);

 

 

result+=a;

}

cout<<a<<" "<<b<<" "<<result<<endl;

system("PAUSE");

return EXIT_SUCCESS;

}

 

Ai învăţat să scrii cu heroglife ?

Link to comment
Share on other sites

  • E D U locked this topic
  • E D U unlocked this topic
  • ANDREY. unpinned this topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.