Advertisement
Mercedes

Untitled

Jun 11th, 2014
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. FILE *archivo;
  7. int num;
  8. char car;
  9. int max=-1;
  10. archivo=fopen("precipitaciones.txt","r");
  11. if(archivo==NULL){
  12. printf("Error, el archivo no se pudo abrir\n");
  13. }
  14. else {
  15. printf("El archivo se abrio correctamente\n");
  16.  
  17.  
  18.  
  19. fscanf(archivo, "%d",&num);
  20. car=fgetc(archivo);
  21.  
  22.  
  23. while(!feof(archivo)){
  24.  
  25. if(max<num){
  26. max=num;}
  27.  
  28.  
  29. fscanf(archivo, "%d",&num);
  30.  
  31.  
  32. car=fgetc(archivo);
  33.  
  34. }
  35.  
  36. printf("El maximo es %d",max);
  37.  
  38. fclose(archivo);
  39.  
  40. }
  41.  
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement