martedì 10 febbraio 2009

massimo come funzione

#include
int massimo(int a,int b){
if(a>b){
return a;
}
else{
return b;
}
}
main(){
int c;
int d;
int max;
printf("inserire numero");
scanf("%d",&c);
printf("inserire un altro numero");
scanf("%d",&d);
while(d!=999){
printf("inserire un altro numero");
scanf("%d",&d);
}
max=massimo(c,d);
printf("il numero massimo è:%d\n",max);
}

Nessun commento: