Fandom

Scratchpad

PLE:Unidad4Ejercicio2

219,434pages on
this wiki
Add New Page
Discuss this page0 Share
#include <stdio>
#include <iostream>
#include <conio>
        using namespace std;

int mayor(int x,int y); //definimos la funcion mayor.

void main()
{
        int result=0,a,b;

        cout<<"Introduce el primer numero : ";
        cin>>a;
        cout<<endl;
        cout<<"Introduce el segundo numero : ";
        cin>>b;
        result=mayor(a,b);   //llamamos a la funcion y metemos el resultado en la variable (result).
        cout<<"el mayor es "<<result;
        getch();
}
int mayor(int x,int y) // funcion mayor 
{
        if(x>y){ 
        return x; // si x es mayor que y devolvemos x.
        }
        else
        return y; // si no ,devolvemos x.

}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random wikia