~eaglescreen/ple/2010-2011

« back to all changes in this revision

Viewing changes to RAFAEL BELMONTE 1ra EVALUACION/generales/15_mayor_y_menor.c

  • Committer: Rafael Belmonte
  • Date: 2011-03-27 13:37:36 UTC
  • Revision ID: eaglescreen@gmail.com-20110327133736-3ooxj7qs93rl5779
Ficheros; atou, MiStricmp; uconio.c:cgets mejorada

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/****************************************************
2
 
* Programa: Leer 100 (o m�s) cantidades y mostrar la menor y la mayor
3
 
* Autor: Rafael Belmonte       Fecha noviembre de 2010
4
 
****************************************************/
5
 
#include<stdio.h>
6
 
#include<conio.h>
7
 
#define CANTIDAD 100
8
 
 
9
 
int main()
10
 
{
11
 
    int num,mayor,menor,i;
12
 
    i=0;
13
 
    printf("Introduzca el %d%c numero:\n>",i+1,167); /*167='�' en ASCII*/
14
 
    scanf("%d",&num);
15
 
    menor=num; /*inicializo al numero leido*/
16
 
    mayor=num; /*inicializo al numero leido*/
17
 
    for (i=1;i<CANTIDAD;i++)
18
 
    {
19
 
        printf("Introduzca el %d\247 numero:\n>",i+1); /*0o247='�' en ASCII*/
20
 
        scanf("%d",&num);
21
 
        if (num>mayor)
22
 
           mayor=num;
23
 
        else if (num<menor)
24
 
           menor=num;
25
 
    }
26
 
    printf("El menor de los numeros leidos es: %d\nEl mayor de los numeros leidos es: %d\n",menor,mayor);
27
 
    printf("\n\nPulse una tecla para salir");
28
 
    getch();
29
 
    return 0;
30
 
}