top of page

#include <iostream>

#include <fstream>

using namespace std;

 

ifstream f("cifra maxima.in");

ofstream g("cifra maxima.txt");

 

int main()

{

    int n, cifmax=0;

    cout<<"n= "; cin>>n; g<<"n= "<<n<<endl;

        while(n%10>cifmax)

        {

            cifmax=n%10;

        n=n/10;

        }

    cout<<cifmax;

        while(n%10>cifmax)

        {

            cifmax=n%10;

        n=n/10;

        }

    g<<cifmax;

    return 0;

}

bottom of page