All pastes #488772 Raw Edit

Something

public text v1 · immutable
·published 2007-05-15 04:59 UTC
rendered paste body
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{int arreglo [5];
 int i, j, temp, numero, promedio;
 int TAM=5;

 
 for (i=0; i<TAM; i++)
 {
  printf("Digite 5 numeros enteros\n");
  printf("\n");
  for (i=0; i<5; i++)  
  {
     printf("Numero %i: ", i+1);           
     scanf("%d", &temp);
     if (temp>=1 && temp<=30)
     {
                arreglo[i] = temp;
     }
     else
     {
         printf("El numero debe estar entre 1 y 30\n");
         i--;
     }
  }  
 }
 
 numero = arreglo[0];
    
 for (i=0; i<TAM; i++)
 {
 numero+= arreglo[i];
 promedio = numero/5;
 }
 
 printf ("La sumatoria de los numeros es: %d\n", numero);
 printf ("El promedio de los numeros es: %d\n", promedio); 
 
 printf ("Los numeros ordenados de mayor a menor son: ");
 
 for (i=0; i<TAM; i++)
 {
     for (j=0; j<TAM; j++)
     {
         if (arreglo[j]>arreglo[j+1])
         {
                                     temp = arreglo[j];
                                     arreglo[j] = arreglo [j+1];
                                     arreglo[j+1] = temp;
         }
     }
     
     printf("%d ", temp);
 }                             

 printf("\n");

  system("PAUSE");	
  return 0;
}