View Code of Problem 23

#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;
int main( )
{
    int a;

    while(cin >>a)
    {
        if(a==0)
        {
            break;
        }
        else
        {
            if(a==1)
            {
                cout << 1<<endl ;
            }
            else
            {
                cout << (a*2-2)<< endl;
            }
        }
    }

    return 0;
}

Double click to view unformatted code.


Back to problem 23