Jump to content

Recommended Posts

Posted

Pana la urma am rezolvat

#include <iostream>
using namespace std;
int main()
{
    int n,c1,c2,nr=0,p=1;
    cout<<"N = "; cin>>n;
    cout<<"C1 = "; cin>>c1;
    cout<<"C2 = "; cin>>c2;

    while(n!=0)
    {
        if(n%10==c1)
            nr=nr+c2*p;
        else
            nr=nr+(n%10)*p;
        p*=10;
        n/=10;
    }
    cout<<nr;

    return 0;
}

 

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.